如何在python中将curl请求转换为requests模块
如何将此curl请求转换为python请求模块compitable(Post请求) 我正在这里搜索请求模块如何在python中将curl请求转换为requests模块,python,curl,request,urllib,Python,Curl,Request,Urllib,如何将此curl请求转换为python请求模块compitable(Post请求) 我正在这里搜索请求模块 http://docs.python-requests.org/en/master/user/quickstart/ 但它们只有数据值作为键,值在那里 r = requests.post('http://httpbin.org/post', data = {'key':'value'}) 那么,如何将上面的curl post请求转换为python请求模块来进行post请求呢?您链接的文
http://docs.python-requests.org/en/master/user/quickstart/
但它们只有数据值作为键,值在那里
r = requests.post('http://httpbin.org/post', data = {'key':'value'})
那么,如何将上面的curl post请求转换为python请求模块来进行post请求呢?您链接的文档中说:
curl 'http://sss.com' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36' -H --data 'aq=%40syssource%3DProFind%20AND%20NOT%20%40title%3DCoveo%20AND%20NOT%20%40title%3Derror&searchHub=ProFind&xxx=yyy&xxx=yyy&xxx=yyy=10&xxx=yyy' --compressed
很多时候,您希望发送未进行表单编码的数据。如果您传入一个字符串而不是dict,则该数据将直接过帐
所以只要使用
r = requests.post('http://sss.com', data = 'aq=%40syssource%3DProFind%20AND%20NOT%20%40title%3DCoveo%20AND%20NOT%20%40title%3Derror&searchHub=ProFind&xxx=yyy&xxx=yyy&xxx=yyy=10&xxx=yyy')