multipart 2fform data multipart encoder python

Solutions on MaxInterview for multipart 2fform data multipart encoder python by the best coders in the world

showing results for - "multipart 2fform data multipart encoder python"
Silvia
05 Jan 2018
1from requests_toolbelt import MultipartEncoder
2import requests
3
4m = MultipartEncoder(
5    fields={'field0': 'value', 'field1': 'value',
6            'field2': ('filename', open('file.py', 'rb'), 'text/plain')}
7    )
8
9r = requests.post('http://httpbin.org/post', data=m,
10                  headers={'Content-Type': m.content_type})