Parsing MIME-encoded data in an HTTP request
Ron Garret
rNOSPAMon at flownet.com
Fri Jul 4 18:37:12 EDT 2008
In article <rNOSPAMon-BDA88C.15302904072008 at news.gha.chartermi.net>,
Ron Garret <rNOSPAMon at flownet.com> wrote:
> In article <3a11k5-al7.ln1 at nb2.stroeder.com>,
> Michael Ströder <michael at stroeder.com> wrote:
>
> > Ron Garret wrote:
> > > I'm writing a little HTTP server and need to parse request content that
> > > is mime-encoded. All the MIME routines in the Python standard library
> > > seem to have been subsumed into the email package, which makes this
> > > operation a little awkward.
> >
> > How about using cgi.parse_multipart()?
> >
> > Ciao, Michael.
>
> Unfortunately cgi.parse_multipart doesn't handle nested multiparts,
> which the requests I'm getting have. You have to use a FieldStorage
> object to do that, and that only works if you're actually in a cgi
> environment, which I am not. The server responds to these requests
> directly.
>
> Anyway, thanks for the idea.
>
> rg
Hm, it actually seems to work if I manually pass in the outerboundary
parameter and environ={'REQUEST_METHOD':'POST'} That seems like the
Right Answer.
Woohoo!
Thanks Michael!
rg
More information about the Python-list
mailing list