[Tutor] File upload from python shell

David Clymer david at zettazebra.com
Sun Oct 14 15:08:02 CEST 2007


On Sun, 2007-10-14 at 01:42 +0100, Paulino wrote:
> Hello!
> 
> 
> How can I upload a file from python?
> 
> If it is a form to fill with values it's simple:
> 
> 
> urlopen("http://site.com/action?key1=value1;key2=value2") and I get the 
> form filled.
> 
> 
> What about uploading a file programmaticaly?


Google tells me that urllib2 does not support file uploads properly,
however it also tells me that one can use httplib directly to do it:

http://wiki.forum.nokia.com/index.php/How_to_upload_a_file_to_server_with_application/x-www-form-urlencoded

-davidc

-- 
gpg-key: http://www.zettazebra.com/files/key.gpg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/tutor/attachments/20071014/a2c34121/attachment.pgp 


More information about the Tutor mailing list