擅长:python、mysql、java
<p>这对我很有效:</p>
<pre><code>c = api.OAuthClient(
client_id,
client_secret,
username,
password,
)
filename = 'screenie.png'
filedata = open(filename, 'r')
"""Create a file from raw data"""
attributes = {'filename': filename,
'source': filedata}
file_upload = c.transport.POST(url='/file/v2/', body=attributes, type='multipart/form-data')
print(file_upload)
</code></pre>
<p>我从这里取了代码:<a href="https://github.com/podio/podio-py/blob/master/pypodio2/areas.py" rel="nofollow">https://github.com/podio/podio-py/blob/master/pypodio2/areas.py</a></p>