using urllib or httplib to post with ENCTYPE=mulitpart/form-data

Kevin Carlson nskhcarlso at
Mon Jun 9 22:42:02 CEST 2003

John J. Lee wrote:
> Kevin Carlson <nskhcarlso at> writes:
> [...]

> No reason why not, but IMHO perverse.  :-)

I agree, it is easier to use urllib, but in this case I have to post 
data in multipart/form-data which means MIME.  I can build the proper 
request and send it using httplib, but haven't been able to figure out 
how to do this with urllib.

If I create the MIME data as 'data', and them post the request using 
urllib.request(URL, data), it doesn't seem to post the form correctly. 
If I do the same with httplib it works fine.  Am I missing something?

Thanks for the help!

More information about the Python-list mailing list