ClientCookie 0.03b released
Changes since 0.02a * The download URL is correct! * Interface is stable. * Has now been used in anger, by me. * Fixed _ClientCookie._host function (now works with proxies). * Fixed HTTPHandler, etc. * Work-around for netscape cookies with bad paths. * Automatic redirections (with urllib2) now work (for netscape cookies only). * Handling of RFC2965 cookies is currently turned off during automatic redirections, until I figure out exactly which cookies should be blocked. * Included fixed version of HTTPRedirectHandler: does GET instead of POST during redirects, as required by RFC1945 (bug #549151 on SF). * str2time function is now importable directly from ClientCookie.
ClientCookie is a Python module for handling cookies on the client side, useful for accessing web sites that require cookies to be set, and returned later. It is a port of Gisle Aas' Perl module HTTP::Cookies, from the libwww-perl library. Both RFC2965 and Netscape cookies are supported.
import ClientCookie import urllib2 request = urllib2.Request("http://www.acme.com/") # note we're using the urlopen from ClientCookie, not urllib2 result = ClientCookie.urlopen(request) # let's say this next request requires a cookie that was set in result request2 = urllib2.Request("http://www.acme.com/flying_machines.html") result2 = ClientCookie.urlopen(request2)
Python 2.0 or above is required (though I may fix it to work with 1.52 eventually), and urllib2 is recommended but not required. Note that the version of urllib2 from Python 2.0 is too old: if you have Python 2.0, get the version from Python 2.1 (available from the source distribution or CVS from http://www.python.org).
Distributed under the Perl Artistic License.
John J. Lee