ClientCookie
John J. Lee
jjl at pobox.com
Wed Aug 11 18:59:04 EDT 2004
fuzzyman at gmail.com (Michael Foord) writes:
> Has anyone used ClientCookie to store cookies ?
> I'm going to play around with 'pickling cookies' - but I wondered if
> anyone had any experience of this.
>
> (For session persistence in approx - my cgi proxy)
Just thought to add:
1. are you using a database for this? (you should be) Look at
BSDDBCookieJar. BSDDBCookieJar isn't well-tested, but might be
just the ticket for what you're doing. It's not in cookielib yet,
but the one from ClientCookie 0.9.x should work fine with
cookielib, and I'll make it available in a separate package RSN,
along with the other stuff in ClientCookie but not in cookielib.
2. here's a simpler way (in a sense) of serialising a CookieJar than
pickling:
cj = cookielib.CookieJar()
...
s = [repr(c) for c in cj]
and unserialising:
cj = cookielib.CookieJar()
for cs in s:
cj.set_cookie(eval(cs))
...
You'd still need to write something like BSDDBCookieJar, though, if
I understand what you're doing.
John
More information about the Python-list
mailing list