如何通过在 Python 中上传文件来创建以下多部分表单数据请求?------WebKitFormBoundaryKVAJlF8rFOTxL7jqContent-Disposition: form-data; name="file"; filename="txtresume.txt"Content-Type: text/plain------WebKitFormBoundaryKVAJlF8rFOTxL7jq-- 我也如何在 python 中发布这个请求
1 回答

阿波罗的战车
TA贡献1862条经验 获得超6个赞
您可以使用请求模块发布文件
import reqeusts
url = 'http://yoururl/'
files = {'file': open('xxx.xls', 'rb')} # or files = {'file': ('xxx.xls', open('xxx.xls', 'rb'), 'application/vnd.ms-excel', {'Expires': '0'})}
r = reqeusts.post(url, files=files)
有关更多资源,您可以查看此链接
添加回答
举报
0/150
提交
取消