I think the problem here is the name of file element. It should be docfile
. In curl example you have passed that as docfile
but in the python script you left it as file
.
Alter this line:
files = {'file': open('file.ext', 'rb')}
to this:
files = {'docfile': open('file.ext', 'rb')}