Scripting HTTP POST - multipart/form-data
John J. Lee
jjl at pobox.com
Mon Jul 19 19:31:49 EDT 2004
Jeff Shannon <jeff at ccvcorp.com> writes:
> I'm looking to script a routine file-upload through an HTTP server
> (which I don't have access to). I've got specs on the CGI app that
> receives this upload (i.e. field names and expected contents).
>
> However, it looks like urllib/urllib2 won't handle multipart/form-data
> POSTs.
Neither should have any problem with multipart/form-data. They don't
actually provide and specific support for it either, though.
[...]
> Is there another (preferably all-python) library that will work for
> this?
[...]
Yes, one that works on top of urllib2:
http://wwwsearch.sf.net/ClientForm
Search for .add_file on that page for an example of file upload. IIRC
I've posted examples of that here in the past, too.
John
More information about the Python-list
mailing list