擅长:python、mysql、java
<p>将文件处理程序作为数据发送,而不是保存在dict中</p>
<pre><code>auth = ('user', passwd)
headers = {'Content-Type': 'text/plain'}
somefile=open('somefile','r')
requests.put(uri, auth=auth, headers=headers, data=somefile, verify=False)
</code></pre>
<p>或者</p>
^{pr2}$
<p>而且您不需要读取文件内容,<code>requests</code>已经为可流化的<code>data</code>&;<code>files</code>参数执行此操作。在</p>