forked from nesies/urllib2_file
-
Notifications
You must be signed in to change notification settings - Fork 0
Extend urllib2 to support HTTP POST file upload
oii/urllib2_file
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Python urllib2_file.py enable you to upload files using HTTP multipart/form-data Install: python setup.py test python setup.py build python setup.py install Example: import urllib2_files import urllib2 data = { 'foo': 'bar', 'form_name': open("/lib/libc.so.1") } (send something like: 'Content-Disposition: form-data; name="form_name"; filename="form_name";' ) Or if you want to specify a different filename: data = {'foo': 'bar', 'form_name': {'fd': open('/lib/libresolv.so.2', 'filename': 'libresolv.so'} } (send something like: 'Content-Disposition: form-data; name="form_name"; filename="libresolv.so";' ) u = urllib2.urlopen('http://site.com/path/upload.php', data) Tested with: python 2.3 python 2.4 python 2.5
About
Extend urllib2 to support HTTP POST file upload
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published