Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 有没有办法在pycurl中获取完整的http请求?_Python_Http_Pycurl - Fatal编程技术网

Python 有没有办法在pycurl中获取完整的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

这是官方文件中的示例。 我想知道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_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()
有关详细信息,请参阅