[Python-Dev] cookielib module in 2.4?

John J Lee jjl at pobox.com
Wed May 12 18:40:12 EDT 2004


I have a module that I'd like to get included in Python 2.4.  It adds
transparent HTTP cookie handling to urllib2 (and urllib too, I guess, if
somebody wants to write the little bit of code I imagine is required).
I'm prepared to maintain the thing, of course.  It has been distributed
for 2 years in a 1.5.2-compatible form, as the ClientCookie package, at
wwwsearch.sf.net.  I've just made a branch in which I have removed 1.5.2
(and various other) cruft, along with some superfluous features, and
turned it into a single-file module (plus a small patch to urllib2).  ATM
it's in a subversion branch here:

http://codespeak.net/svn/user/jjlee/wwwsearch/ClientCookie/branch/python-2.4_candidate/


I've renamed it 'cookielib'.  That's partly to fit in with the Python
standard library's naming convention for network client modules, partly so
that it's clear to people whether they're importing the old
1.5.2-compatible version or the 2.4 standard library version.  Actually,
the most frequent use case does not involve importing the module:

import urllib2
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
response = opener.open("http://example.com/")


So, assuming the module is likely to be accepted (given the answers to my
post here last year), I'd be happy if anybody here could

1. indicate if I'm roughly on the right track (especially welcome if
   you've had a look at the subversion branch above),

2. give me a rough idea how long I have to sort out the remaining issues
   and submit a patch


The major remaining issue is documentation, which is not yet in LaTeX
format (nor in Python std. lib. style) -- see my next post.  There are
also two or three niggles which I'd like to discuss with Jeremy Hylton,
Moshe Zadka, or anybody else who knows urllib2.  Finally, there's the fact
that the module contains untested thread-synchronisation code (I'm pretty
thread-ignorant).  Perhaps that's an academic issue ATM, though:  I failed
recently to eliminate deadlocks in a fairly simple bit of code using
urllib2 + threading, even when I verified there were no locks allocated by
any module other than threading itself...

TIA


John



More information about the Python-Dev mailing list