cookielib extracting a cookie value as a string

dmbkiwi at gmail.com dmbkiwi at gmail.com
Sat Jan 28 03:14:46 CET 2006


I am trying to extract the value of a cookie from a CookieJar() object
using cookielib.  I have a CookieJar() object called cj.  Printing cj
gives:

<_LWPCookieJar.LWPCookieJar[<Cookie GA3T=NhOw_0XH3bY for
www.google.com/accounts>, <Cookie GoogleAccountsLocale_session=en for
www.google.com/accounts>]>

But i can't work out how to extract the value.

If I use make_cookies(), I get:

[Cookie(version=0, name='GA3T', value='XMi__nHPWW4', port=None,
port_specified=False, domain='www.google.com', domain_specified=False,
domain_initial_dot=False, path='/accounts', path_specified=False,
secure=False, expires=None, discard=True, comment=None,
comment_url=None, rest={}), Cookie(version=0,
name='GoogleAccountsLocale_session', value='en', port=None,
port_specified=False, domain='www.google.com', domain_specified=False,
domain_initial_dot=False, path='/accounts', path_specified=False,
secure=False, expires=None, discard=True, comment=None,
comment_url=None, rest={})]

But I can't find a simple way to get the "value" key pair, so I can
manipulate it as a string.

Can anyone please help.




More information about the Python-list mailing list