cookielib extracting a cookie value as a string

D

dmbkiwi

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top