AKA 1
requests.post(files=?)
Today I was attempting to POST
some data to Docverter’s API with the python requests library, and ran into a problem. Although
supports a 1
requests.post
files
keyword argument, it does not seem to support custom, per file, Content-Type
headers.
However, trawling through the source code, it would seem that yes, yes, it does. It’s just not documented. It was initially added in a commit over a year ago, but alas, the commit did not include documentation.
It seems the following are possible, where ellipses indicate the inclusion of every argument of the above example;
Albeit good that these different forms are supported, ideally all forms should be documented, not just the first.
N.B; now that I know what to look for, the Content-Type
form is also mentioned in a Stackoverflow answer, and in the urllib3
documentation (though it fails to mention the custom headers)