M
Michael Foord
Does anyone know how to do a 'file upload' using urllib2 ?
There is an example of doing file upload using httplib - on
activestate python cookbook.
I have code that uses a request object to make requests using
urllib2.urlopen (including cookie handling via ClientCookie) - which
means it would be extremely incovenient (including probably not
working without the cookie handling) to have to use httplib. It would
also mean duplicating the code...
I had thought of just adding the headers manually using add_header -
but for multipart data we need boundaries and the suchlike...... Has
anyone done this or know the right incantations to do it ?
Regards,
Fuzzy
http://www.voidspace.org.uk/atlantibots/pythonutils.html
There is an example of doing file upload using httplib - on
activestate python cookbook.
I have code that uses a request object to make requests using
urllib2.urlopen (including cookie handling via ClientCookie) - which
means it would be extremely incovenient (including probably not
working without the cookie handling) to have to use httplib. It would
also mean duplicating the code...
I had thought of just adding the headers manually using add_header -
but for multipart data we need boundaries and the suchlike...... Has
anyone done this or know the right incantations to do it ?
Regards,
Fuzzy
http://www.voidspace.org.uk/atlantibots/pythonutils.html