Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Authenticating with Piazza's Internal REST API
import urllib2
from cookielib import CookieJar
cj = CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
# login to Piazza.
login_url = ''
login_data = '{"method":"user.login","params":{"email":"","pass":"fakePassword"}}'
# if the user/password match, the server respond will contain a session cookie
# that you can use to authenticate future requests.
login_resp =, login_data)
# get the content of some random Piazza post on the 15-214 Piazza site.
content_url = ''
content_data = '{"method":"content.get","params":{"cid":"hm8b1yx8v234m2","nid":"hkqe3rh2nlz35d"}}'
content_resp =, content_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment