首页 > 解决方案 > 将 HTTP Post 请求转换为 python 请求

问题描述

我想将一个巨大的文件上传到服务器,所以文件需要分块上传。

HTTP 请求如下所示。

POST /upload/{uuid}?chunk={chunk-number}
X-APPLICATION-ID: {client-id}
Content-Type: multipart/form-data; boundary=----=_Part_1_1673119682
 
------=_Part_1_1673119682
Content-Type: application/octet-stream; name=<file_name>
Content-Transfer-Encoding: binary
Content-Disposition: form-data; name="file"; filename=<file_name>
 
...
------=_Part_1_1673119682--

我在将此请求转换为 python requests.post 时遇到困难

如何添加两个 Content-Type?

标签: python-3.xpostpython-requestshttp-headersrest

解决方案


推荐阅读