Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
requests默认情况下,在发送多部分 HTTP POST 请求时,我通过files带有 Content-Type 的参数发送文本。application/octet-stream有没有办法可以强迫它text/plain代替?
requests
files
application/octet-stream
text/plain
requests不幸的是,这不受支持。底层urllib3库确实支持处理 3 值元组(带有文件名、数据和 mime 类型),但requests不支持对files允许您传入 mime 类型的参数进行任何处理。
urllib3
目前正在修改POST 请求的文件处理方式,但现在有一个补丁可供您使用。