def stats(self): parser = argparse.ArgumentParser( description='Get course post stats') parser.add_argument('network', help='Network ID for target Piazza class') args = parser.parse_args(sys.argv[2:]) pz = piazza.Piazza(args.network, creds.auth) print(pz.get_stats())
def posts(self): parser = argparse.ArgumentParser( description='Get all posts visible to current user') parser.add_argument('network', help='Network ID for target Piazza class') args = parser.parse_args(sys.argv[2:]) pz = piazza.Piazza(args.network, creds.auth) for i in pz.iter_all_posts(): print(i)
def getuser(self): parser = argparse.ArgumentParser( description='Get user info') parser.add_argument('network', help='Network ID for target Piazza class') args = parser.parse_args(sys.argv[2:]) pz = piazza.Piazza(args.network, creds.auth) profs = pz.get_user_profiles() print(profs)
def post(self): parser = argparse.ArgumentParser( description='Get all posts visible to current user') parser.add_argument('network', help='Network ID for target Piazza class') parser.add_argument('cid', help='Piazza post ID (cid)') args = parser.parse_args(sys.argv[2:]) pz = piazza.Piazza(args.network, creds.auth) post = pz.get_post(args.cid) print(json.dumps(post))
def scrape(self): parser = argparse.ArgumentParser( description='Starting from post 1, capture each post until no more are found') parser.add_argument('network', help='Network ID for target Piazza class') parser.add_argument('out', help='Directory to write JSON') args = parser.parse_args(sys.argv[2:]) pz = piazza.Piazza(args.network, creds.auth) post = pz.get_all(args.out) print(post)
def serve(self): parser = argparse.ArgumentParser( description='Start local development server') pz = piazza.Piazza()