Skip to content

Instantly share code, notes, and snippets.

@dmtmov
Created June 11, 2020 14:49
Show Gist options
  • Save dmtmov/7f72da7dd9310e858132183549dbb517 to your computer and use it in GitHub Desktop.
Save dmtmov/7f72da7dd9310e858132183549dbb517 to your computer and use it in GitHub Desktop.
urllib3 multipart/form-data
import urllib3
r = http.request(
'POST',
'https://example.com/createRecord',
fields={
'foo': 'bar',
'your_field': ('filename.tar.gz', open('full/path/filename.tar.gz', 'rb').read())
})
print(r.data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment