网站更新内容:请访问: https://bigdata.ministep.cn/

python-requests的post

python-requests的post

python requests Content-Length

How not to let python requests calculate content-length and use the provided one? - Stack Overflow

from requests import Request, Session

s = Session()

req = Request('POST', url, data=data, headers=headers)
prepped = req.prepare()

# do something with prepped.headers
prepped.headers['Content-Length'] = your_custom_content_length_calculation()

resp = s.send(prepped, ...)

requests post 修改了Content-Length

官方文档:
Advanced Usage — Requests 2.26.0 documentation

posted @ 2021-10-16 06:38  ministep88  阅读(66)  评论(0编辑  收藏  举报
网站更新内容:请访问:https://bigdata.ministep.cn/