ANN: ClientCookie 0.4.14 and 0.9.0a released

John J. Lee
29 Dec 2003 20:15:53 +0000

0.4.14 is a stable bugfix release.

0.9.0a is the first alpha release of a final version, parts of which I hope
to get into Python 2.4.

Changes since 0.4.11:

 * Fixed a bug where https requests were missing important headers (like
 * Other bugfixes.
 * Replaced all usage of seek_wrapper with new class
   response_seek_wrapper, which knows about the response class returned by
   urllib2.urlopen(), and uses that knowledge to avoid clobbering all the
   response methods on .close().  This is a bit of a hack to make it
   possible to cache response objects to make a Browser class (as in my
   mechanize module).

In new 0.9 development version:

 * Everything to do with files is now in an abstract FileCookieJar
   subclass.  libwww-perl format save/load is now in LWPCookieJar, and the
   CookieJar base class now knows nothing about files (but you can still
   use CookieJar directly -- it's not an abstract base class).
 * Added BSDDBCookieJar (NOT FULLY TESTED!).  Also, an unfinished (non-
   working) MSIEDBCookieJar, which is meant to use (read and write) the
   Windows MSIE cookies database directly, rather than keeping a copy of
   cookies in memory.
 * RFC 2965 is now off by default.
 * Made CookieJar.cookies attribute private.
 * FileCookieJar.load() and .revert() now raise ClientCookie.LoadError
   instead of IOError when the file format is not understood (IOError is
   still raised in the usual circumstances).
 * Changed skip_discard arg to LWPCookieJar.as_lwp_str() to ignore_discard
   (inverted meaning), and skip_expired to ignore_expires, for
 * Documented HTTPCookieProcessor.cookiejar and
   HTTPRefreshProcessor.max_time / .honor_time as public attributes.

Requires Python >= 1.5.2.

ClientCookie is a Python module for handling HTTP cookies on the client
side, useful for accessing web sites that require cookies to be set and
then returned later.  It also provides some other (optional) useful stuff:
HTTP-EQUIV and Refresh handling, automatic adding of the Referer [sic]
header and lazily-seek()able responses.  These extras are implemented
using an extension that makes it easier to add new functionality to
urllib2.  It has developed from a port of Gisle Aas' Perl module
HTTP::Cookies, from the libwww-perl library.

Simple usage:

 import ClientCookie
 response = ClientCookie.urlopen("")

This function behaves identically to urllib2.urlopen, except that it deals
with cookies automatically.  That's probably all you need to know.