Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54848
| From | Piet van Oostrum <piet@vanoostrum.org> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2 |
| Date | 2013-09-26 14:44 -0400 |
| Message-ID | <m2eh8bifsh.fsf@cochabamba.vanoostrum.org> (permalink) |
| References | (1 earlier) <mailman.335.1380168701.18130.python-list@python.org> <870d6a97-613d-401f-ad03-0bbd3b088538@googlegroups.com> <mailman.336.1380170351.18130.python-list@python.org> <bairt0FcltgU1@mid.individual.net> <defb0c5f-705a-427c-84c9-83e3bab573e3@googlegroups.com> |
Nils Bunger <nilsbunger@gmail.com> writes: > Hi Neil, > > Thanks for looking at this. > > I'm trying to create a multipart MIME for an HTTP POST request, not an > email. This is for a third-party API that requires a multipart POST > with a binary file, so I don't have the option to just use a different > encoding. > > Multipart HTTP is standardized in HTTP 1.0 and supports binary parts. > Also, no one will re-interpret contents of HTTP on the wire, as binary > is quite normal in HTTP. > > The issue seems to be some parts of the python MIME encoder still > assume it's for email only, where everything would be b64 encoded. > > Maybe I have to roll my own to create a multipart msg with a binary > file? I was hoping to avoid that. The email MIME stuff is not really adapted for HTTP. I would advise to use the Requests package (http://docs.python-requests.org/en/latest/) or the Uploading Files part from Doug Hellmann's page (http://doughellmann.com/2009/07/pymotw-urllib2-library-for-opening-urls.html). This is for Python2; I can send you a Python3 version if you want. -- Piet van Oostrum <piet@vanoostrum.org> WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4]
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2 nilsbunger@gmail.com - 2013-09-25 09:38 -0700
Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2 Chris Angelico <rosuav@gmail.com> - 2013-09-26 14:11 +1000
Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2 Nils Bunger <nilsbunger@gmail.com> - 2013-09-25 21:23 -0700
Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2 Chris Angelico <rosuav@gmail.com> - 2013-09-26 14:32 +1000
Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2 Neil Cerutti <neilc@norwich.edu> - 2013-09-26 13:41 +0000
Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2 Nils Bunger <nilsbunger@gmail.com> - 2013-09-26 08:56 -0700
Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2 Piet van Oostrum <piet@vanoostrum.org> - 2013-09-26 14:44 -0400
Re: Newline interpretation issue with MIMEApplication with binary data, Python 3.3.2 Nils Bunger <nilsbunger@gmail.com> - 2013-09-26 09:35 -0700
csiph-web