Skip to content

Instantly share code, notes, and snippets.

@kayzhu
Created September 24, 2012 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kayzhu/3778116 to your computer and use it in GitHub Desktop.
Save kayzhu/3778116 to your computer and use it in GitHub Desktop.
A sample script to make requests to pycon.ca
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