Python 有没有办法在pycurl中获取完整的http请求?
这是官方文件中的示例。 我想知道http请求是什么样子的。Python 有没有办法在pycurl中获取完整的http请求?,python,http,pycurl,Python,Http,Pycurl,这是官方文件中的示例。 我想知道http请求是什么样子的。 有办法吗?您可以使用VERBOSE选项,类似于curl-v,将请求/响应头打印到stderr: c = pycurl.Curl() c.setopt(c.URL, 'https://httpbin.org/post') post_data = {'field': 'value'} # Form data must be provided already urlencoded. postfields = urlencode(post_d
有办法吗?您可以使用
VERBOSE
选项,类似于curl-v
,将请求/响应头打印到stderr
:
c = pycurl.Curl()
c.setopt(c.URL, 'https://httpbin.org/post')
post_data = {'field': 'value'}
# Form data must be provided already urlencoded.
postfields = urlencode(post_data)
# Sets request method to POST,
# Content-Type header to application/x-www-form-urlencoded
# and data to send in request body.
c.setopt(c.POSTFIELDS, postfields)
c.perform()
c.close()
有关的详细信息,请参见。您可以使用
VERBOSE
选项,类似于curl-v
,将请求/响应标题打印到stderr
:
c = pycurl.Curl()
c.setopt(c.URL, 'https://httpbin.org/post')
post_data = {'field': 'value'}
# Form data must be provided already urlencoded.
postfields = urlencode(post_data)
# Sets request method to POST,
# Content-Type header to application/x-www-form-urlencoded
# and data to send in request body.
c.setopt(c.POSTFIELDS, postfields)
c.perform()
c.close()
有关详细信息,请参阅