I am doing a simple POST request using the requests module, and testing it against httpbin
import requests url = 'http://httpbin.org/post' params = {'apikey':'666666'} sample = {'sample': open('test.bin', 'r')} response = requests.post( url, files=sample, params=params, verify=False) report_info = response.json() print report_info I have an issue with the encoding. It is not using application/octet-stream and so the encoding is not correct. From the headers, I see:
{ u'origin': u'xxxx, xxxxxx', u'files': { u'sample': u'data:None;base64,qANQR1DBw.......... So, I get data:None instead of data:application/octet-stream when I try with curl. The file size and encoding is incorrect.
How can I force or check that it is using application/octet-stream?