# Install piazza_api package from # https://github.com/hfaran/piazza-api/ # pip installs to Python 2 libraries by default, so this script is in 2, not 3 from piazza_api import Piazza f = open(raw_input("Name of output file: ") + ".html", "w") header = """ \n""" f.write(header) p = Piazza() print("Awaiting Piazza login credentials...") p.user_login() course = p.network(raw_input("Piazza course ID (e.g. jv2glfqrxvd1d5): ")) posts = reversed(list(course.iter_all_posts())) # Filters to retrieve instructor notes only (edit condition to try other tags) # Produces .html file which can be viewed nicely formatted in a web browser for p in posts: if 'instructor-note' in p['tags']: f.write('=========

\n') f.write(p['created'].encode('utf-8') + '
\n') f.write(p['history'][0]['subject'].encode('utf-8') + '\n') f.write(p['history'][0]['content'].encode('utf-8') + '\n') f.write('=========\n') footer = """ """ f.write(footer)