P
prefetch
hi people -
i'm new to python, but i'm quickly becoming a fan.
i'm using BaseHTTPServer and wrote a do_POST method, which i'd like to
read posted files and write them to disk. seems like it should be
simple.
well, i'm having problems - i can read the "raw" posted file, but it
has the MIME header and delimeter included. (below)
#this works, but includes all the MIME header & delimiter stuff
data = self.rfile.read(int(self.headers["content-length"]))
of course, i'd like to parse out all that nasty stuff so i can
actually get to the 'payload'. so it looks like all the docs point to
the email package for this kind of thing. so i try this:
myParser = email.Parser.Parser()
data = myParser.parse(self.rfile) # hang forever here
so, am i lame? why won't this actually work?
note that i do not want to use the cgi module - i'd like to figure out
how to make this work with just BaseHTTPServer. i should, right?
i'm new to python, but i'm quickly becoming a fan.
i'm using BaseHTTPServer and wrote a do_POST method, which i'd like to
read posted files and write them to disk. seems like it should be
simple.
well, i'm having problems - i can read the "raw" posted file, but it
has the MIME header and delimeter included. (below)
#this works, but includes all the MIME header & delimiter stuff
data = self.rfile.read(int(self.headers["content-length"]))
of course, i'd like to parse out all that nasty stuff so i can
actually get to the 'payload'. so it looks like all the docs point to
the email package for this kind of thing. so i try this:
myParser = email.Parser.Parser()
data = myParser.parse(self.rfile) # hang forever here
so, am i lame? why won't this actually work?
note that i do not want to use the cgi module - i'd like to figure out
how to make this work with just BaseHTTPServer. i should, right?