multipart encoder

Solutions on MaxInterview for multipart encoder by the best coders in the world

showing results for - "multipart encoder"
Sarah
05 Jan 2019
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})
11