[Tutor] Cookielib - CookieJar objects

D. Hartley denise.hartley at gmail.com
Wed Jun 29 02:49:53 CEST 2005


Hi everyone! Just a quick question about cookie jars:

when I create a myjar = cookielib.CookieJar(), and go to a website to
get the particular cookie, I get something like this in return:

<cookielib.CookieJar[Cookie(version=0, name='info', value='B',
port=None, port_specified=False, domain='.pythonchallenge.com',
domain_specified=True, domain_initial_dot=True, path='/',
path_specified=True, secure=False, expires=1120610689, discard=False,
comment=None, comment_url=None, rest={})]>

or, if I do print myjar, this:  <cookielib.CookieJar[<Cookie info=B
for .pythonchallenge.com/>]> .

Now, if I wanted to pull out just the value from the cookie (i.e., "B"
in this particular case, labelled as "cookie info" in the print
statement and 'value=' in the cookiejar instance), how could I do
that?

I have tried looking through the documentation and its examples, tried
__doc__ and help() and dir() and can't find it.  Perhaps I'm just
missing something, but does anyone know?

Thanks!

~Denise


More information about the Tutor mailing list