使用 python-requests 上传文件 - UnicodeDecodeError

2024-02-21

我正在尝试使用 python-requests 上传文件

with open('file.zip','rb') as fff:
    up = requests.post(url,files=[('file[]',fff)])

并得到:

UnicodeDecodeError: 'ascii' codec can't decode byte ...

当尝试使用 unicode(fff) 并且文件已上传但后来我下载了它并且它只有 70 个字节

用记事本打开ZIP文件的内容:

<open file 'file.zip', mode 'rb' at 0x0000000002F6E030>

None

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 python-requests 上传文件 - UnicodeDecodeError 的相关文章

随机推荐