python requests get cookies 1

python requests get cookies

>>> import requests
>>> session = requests.Session()
>>> response = session.get('')
>>> print(session.cookies.get_dict())
{'PREF': 'ID=5514c728c9215a9a:FF=0:TM=1406958091:LM=1406958091:S=KfAG0U9jYhrB0XNf', 'NID': '67=TVMYiq2wLMNvJi5SiaONeIQVNqxSc2RAwVrCnuYgTQYAHIZAGESHHPL0xsyM9EMpluLDQgaj3db_V37NjvshV-eoQdA8u43M8UwHMqZdL-S2gjho8j0-Fe1XuH5wYr9v'}

Here is what the above code is Doing:
1. We create a new session object.
2. We make a request to
3. We print the cookies that were sent back to us.

The cookies are stored in a dictionary, and we can access them by their key.

Similar Posts