Python‎ > ‎requests‎ > ‎

requests.cookies


Definition
Request cookies in requests.

Syntax
requests.cookies
requests.get.cookies

Examples
 >>>import requests
>>> r=requests.get('http://www.hotmail.com')
>>> r.cookies
<RequestsCookieJar[Cookie(version=0, name='MSPOK', value='$uuid-fb93621d-db71-4ba7-a74a-0081c2d0ea99', port=None, port_specified=False, domain='.login.live.com', domain_specified=True, domain_initial_dot=False, path='/', path_specified=True, secure='', expires=None, discard=True, comment=None, comment_url=None, rest={'HTTPOnly': ''}, rfc2109=True), Cookie(version=0, name='MSPRequ', value='lt=1430262851&co=1&id=64855', port=None, port_specified=False, domain='login.live.com', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure='', expires=None, discard=True, comment=None, comment_url=None, rest={'HTTPOnly': ''}, rfc2109=True)]>
>>> 


 >>> import requests
>>> requests.get('http://www.pythonlake.com', params='python')
<Response [200]>
>>> r=requests.get('http://www.pythonlake.com',params='python')
>>> r.cookies
<RequestsCookieJar[]>
>>> c=r.cookies
>>> c.copy
<bound method RequestsCookieJar.copy of <RequestsCookieJar[]>>
>>> c.add_cookie_header
<bound method RequestsCookieJar.add_cookie_header of <RequestsCookieJar[]>>
>>> c.domain_re
re.compile('[^.]*')
>>> c.extract_cookies
<bound method RequestsCookieJar.extract_cookies of <RequestsCookieJar[]>>
>>> c.list_paths
<bound method RequestsCookieJar.list_paths of <RequestsCookieJar[]>>
>>> c.update
<bound method RequestsCookieJar.update of <RequestsCookieJar[]>>
>>> 

Comments