ANN: ClientCookie 1.0.0a released

John J. Lee jjl at pobox.com
Thu Sep 16 01:17:30 CEST 2004


http://wwwsearch.sourceforge.net/ClientCookie/

0.4.19 is still the stable version.  0.4.x will not be actively
maintained as soon as a final 1.0 release is out (which will happen
when Python 2.4 is released).  I will likely fix bugs in 0.4.x if
asked, though.

1.0.0a is an alpha release of a "final" version, parts of which will
be in Python 2.4, as new module cookielib and updates to urllib2.
Although still alpha, the interface is now unlikely to change.

This release contains lots of changes to bring ClientCookie into line
with cookielib and Python 2.4's urllib2.  Once a final patch has been
applied to cookielib (I'm just about to upload the patch), anything in
the ClientCookie interface that differs from 2.4's urllib2 / cookielib
is probably a bug.

ClientCookie will remain backwards-compatible with older Pythons.
However, this release requires Python 2.0 or newer.  Python 1.5.2 is
no longer supported. For detailed history, please see the ChangeLog:

http://wwwsearch.sourceforge.net/ClientCookie/src/ChangeLog.txt


and the SVN repository:

http://codespeak.net/svn/user/jjlee/wwwsearch/ClientCookie/trunk/


Backwards-incompatible changes from 0.4.x to 1.0.x:

* RFC 2965 is now off by default.

* AbstractHTTPHandler (hence all HTTP functionality) now uses
  httplib.HTTPConnection instead of httplib.HTTP.  This means that
  ClientCookie now claims to be an HTTP/1.1 client instead of 1.0.
  Same goes for HTTPS.

* CookieJar now knows nothing about files.  If you want to write
  cookies to a file, and don't need to use a browser-compatible file
  format, use LWPCookieJar.  CookieJars that know about files now
  derive from FileCookieJar.

* FileCookieJar.load(), .revert() and .save() now raise LoadError in
  addition to IOError.

* CookieJar.cookies attribute is now private.

* Renamed ClientCookie.Request.iter_headers() to .header_items().

* Request.unverifiable and .origin_req_host are now private,
  replaced by methods .get_unverifiable() and .get_origin_req_hoot().
  The constructor now has arguments to set these attributes.  Some old
  code still returns urllib2.Request objects: in that case, set
  these attributes directly on the urllib2.Request, and
  RequestUpgradeProcessor will carry them over when upgrading them to
  ClientCookie.Request objects (yuck).

* Cookie.rest is now private: use has_nonstandard_attr(),
  get_nonstandard_attr() and set_nonstandard_attr() instead.



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, robots.txt observance 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("http://www.example.com/")

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


John


More information about the Python-announce-list mailing list