Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kdm9/multiparthandler

Updated version of MultipartPostHandler
https://github.com/kdm9/multiparthandler

Last synced: 11 days ago
JSON representation

Updated version of MultipartPostHandler

Awesome Lists containing this project

README

        

multiparthandler:
A module to allow urllib2 to POST to multipart/form-data forms.
This is an updated version of MultipartPostHandler, by Will Holcomb.
The original module has been modernized, and made compatible with Python 3.x.

License:
Copyright (c) 2012 Kevin Murray [email protected]

multiparthandler is licensed under the LGPL v3
See for full license text.

NOTE: This is not an official updated version of MultipartPostHandler,
and is not affiliated with the original author in any way.

Example Usage:
(Adapted from MultipartPostHandler's example)
>>>import multiparthandler
>>>import urllib2
>>>import cookielib
>>>cookies = cookielib.CookieJar()
>>>opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies),
... multiparthandler.multiparthandler)
>>>params = { "username" : "bob", "password" : "riviera",
... "file" : open("filename", "rb") }
>>>opener.open("http://wwww.bobsite.com/upload/", params)

Further Examples can be found in the unittests provided in the ```tests/``
directory.