Created
December 13, 2015 22:26
-
-
Save davidcomfort/a5585824f3c41052b6c6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
session = requests.Session() | |
params = {'username': 'username', 'password': 'password'} | |
s = session.post("http://pythonscraping.com/pages/cookies/welcome.php", params) | |
print("Cookie is set to:") | |
print(s.cookies.get_dict()) | |
print("-----------") | |
print("Going to profile page...") | |
s = session.get("http://pythonscraping.com/pages/cookies/profile.php") | |
print(s.text) | |
Cookie is set to: | |
{'username': 'username', 'loggedin': '1'} | |
----------- | |
Going to profile page... | |
Hey username! 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