Python requests模块提交请求,不同content-type对应的post方法记录

1.'content-type':'application/x-www-form-urlencoded'
data参数提交文本或字典都可以headers为空时,data提交content-type默认也是application/x-www-form-urlencoded
requests.post(url,headers={'content-type':'application/x-www-form-urlencoded'},data='f=10')

requests.post(url,headers={'content-type':'application/x-www-form-urlencoded'},data={'f':10})

2. 'content-type':'application/json'
data参数提交或json参数提交data参

Python requests模块提交请求,不同content-type对应的post方法记录最先出现在Python成神之路

版权声明:
作者:Mr李
链接:https://www.techfm.club/p/21406.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>