Created
December 13, 2015 22:24
-
-
Save davidcomfort/975d9959dfdd8a9a03f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
params = {'username': 'Ryan', 'password': 'password'} | |
r = requests.post("http://pythonscraping.com/pages/cookies/welcome.php", params) | |
print("Cookie is set to:") | |
print(r.cookies.get_dict()) | |
print("-----------") | |
print("Going to profile page...") | |
r = requests.get("http://pythonscraping.com/pages/cookies/profile.php", cookies=r.cookies) | |
print(r.text) | |
Cookie is set to: | |
{'username': 'Ryan', 'loggedin': '1'} | |
----------- | |
Going to profile page... | |
Hey Ryan! Looks like you're still logged into the site! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment