Extracting cookie information after visiting a website
Many websites use cookies to store their various information on to your local disk. You would like to see this cookie information and perhaps log in to that website automatically using cookies.
How to do it...
Let us try to pretend to log in to a popular code-sharing website, https://bitbucket.org/. We would like to submit the login information on the login page, https://bitbucket.org/account/signin/?next=/. The following screenshot shows the login page:
Log in to BitBucket
So, we note down the form element IDs and decide which fake values should be submitted. We access this page the first time, and the next time, we access the home page to observe what cookies have been set up.
Listing 4.3 explains extracting cookie information as follows:
#!/usr/bin/env python # Python Network Programming Cookbook -- Chapter - 4 # This program requires Python 3.5.2 or any later version # It may run on any other version with/without modifications. # ...