类似这样使用!
req = scrapy.FormRequest(‘http://httpbin.org/post’, formdata=data)
例子:
In [29]: req = scrapy.FormRequest(‘http://httpbin.org/post’, formdata=data)
In [30]: fetch(req)
In [31]: response
Out[31]:
In [32]: print(response.body_as_unicode())
“args”: {},
“data”: “”,
“files”: {},
“form”: {
“name”: “python”
“headers”: {
“Accept”: “text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8″,
“Accept-Encoding”: “gzip,deflate”,
“Accept-Language”: “en”,
“Connection”: “close”,
“Content-Length”: “11”,
“Content-Type”: “application/x-www-form-urlencoded”,
“Host”: “httpbin.org”,
“User-Agent”: “Scrapy/1.4.0 (+http://scrapy.org)”
“json”: null,
“origin”: “112.96.195.12”,
“url”: “http://httpbin.org/post”
In [33]: r = requests.post(‘http://httpbin.org/post’, data=data)
In [34]: print(r.text)
“args”: {},
“data”: “”,
“files”: {},
“form”: {
“name”: “python”
“headers”: {
“Accept”: “/“,
“Accept-Encoding”: “gzip, deflate”,
“Connection”: “close”,
“Content-Length”: “11”,
“Content-Type”: “application/x-www-form-urlencoded”,
“Host”: “httpbin.org”,
“User-Agent”: “python-requests/2.18.4”
“json”: null,
“origin”: “112.96.195.12”,
“url”: “http://httpbin.org/post”
Original: https://blog.csdn.net/weixin_39798031/article/details/114431859
Author: weixin_39798031
Title: python提交post请求payload webkit_scrapy 怎么post 请求payload形式的参数
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/792804/
转载文章受原作者版权保护。转载请注明原作者出处!