1. 程式人生 > >python爬蟲psot請求所提交的資料型別

python爬蟲psot請求所提交的資料型別

1. 普通字典格式

2.需轉成json格式:json.dump(dict)

3.'Content-Type': 'multipart/form-data; boundary=AXkzXNkTirE6nx7cLrcNh37nmvvXOD'  型別

from requests_toolbelt  import MultipartEncoder
data = {'mobile': '1323','password': 'xfff44'}
m = MultipartEncoder(data)
headers['Content-Type'] = m.content_type
response = requests.post(url, headers=headers, data=m, proxies=proxies, verify=False,timeout=5)

參考:

https://www.jianshu.com/p/902452189ca9