Created
September 24, 2012 20:20
-
-
Save kayzhu/3778116 to your computer and use it in GitHub Desktop.
A sample script to make requests to pycon.ca
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 | |
payload = { | |
'username': 'MY_USERNAME', | |
'password': 'MY_PASSWORD', | |
'login.submit': 'Login' | |
} | |
user_id = 8 # change it to your user_id for testing purpose | |
talk_id = 8 # change it for testing purpose | |
with requests.session() as s: | |
response_post = s.post('http://pycon.ca/login', data=payload) | |
user_resp = s.get('http://pycon.ca/user/' + str(user_id) + ".json") | |
print user_resp.json | |
talk_resp = s.get('http://pycon.ca/talk/' + str(talk_id) + ".json") | |
print talk_resp.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment