I don’t think 100-Continue will be the issue here: Requests just ignores it.
What’s likely happening here is that the remote server is sending a 400 Client Error, but Requests doesn’t see it because it’s busy uploading the data and eventually the server gets mad and kills the connection to stop more data arriving. This is a known problem with Requests that comes out of httplib, and we’re actively working to fix it (by killing httplib). The only major difference between what Requests sends here and what curl sends is that curl is adding a Content-Type header to the file that Requests is not. Otherwise the differences are entirely in headers that should be irrelevant. You can try changing your code to use `files = {‘aFile’: (‘test.zip’, open(‘/tmp/test.zip’, ‘rb’), ‘application/octet-stream’)}` (or whatever you judge the correct content-type of a zip file to be). Cory > On 2 Dec 2016, at 17:37, Peter Flood <i...@whywouldwe.com> wrote: > > Are you uploading to S3? 100 Continue is pretty obscure, it's sent by the > server _before_ the client has sent the body, lots of clients don't expect > that and handle it badly. Seehttps://github.com/boto/boto/issues/2207 > <https://github.com/boto/boto/issues/2207> > On 02/12/2016 16:10, Florian BERBAR wrote: >> Good evening everyone, >> >> I try to post a file (100MB) on a Web form with python3 and the 'requests' >> package. >> >> This is my implementation : >> >> --------------------------------------BOF------------------------------------------------- >> >> >> #!/usr/local/bin/python3 -u >> >> import requests >> >> email="u...@srv.fr" <mailto:u...@srv.fr> >> >> try: >> res = requests.post('http://server/Upload/upload.php >> <http://server/Upload/upload.php>', >> files={'aFile': open('/tmp/test.zip','rb')}, >> data={'email': email, 'submitFile': 'Envoyer le >> fichier'}) >> >> except requests.exceptions.Timeout: >> print('timeout') >> >> print(res.content) >> >> --------------------------------------EOF------------------------------------------------- >> >> This code semas to be correct, but it return a ConnectionResetError: [Errno >> 104] Connection reset by peer >> >> The same upload with curl work perfectly with this command : >> >> curl --form aFile=@"/tmp/test.zip" --form email="u...@srv.fr" >> <mailto:u...@srv.fr> --form submitFile="Envoyer le fichier" >> http://server/Upload/upload.php <http://server/Upload/upload.php> >> >> Thanks to the advance >> >> Florian >> >> _______________________________________________ >> python-uk mailing list >> python-uk@python.org <mailto:python-uk@python.org> >> https://mail.python.org/mailman/listinfo/python-uk >> <https://mail.python.org/mailman/listinfo/python-uk> > > _______________________________________________ > python-uk mailing list > python-uk@python.org > https://mail.python.org/mailman/listinfo/python-uk
_______________________________________________ python-uk mailing list python-uk@python.org https://mail.python.org/mailman/listinfo/python-uk