hfaran / piazza-api

Unofficial Client for Piazza's Internal API
https://hfaran.github.io/posts/reverse-engineering-piazzas-api/
MIT License
185 stars 54 forks source link

Implement add instructor follow up #67

Closed vishhvak closed 1 year ago

vishhvak commented 1 year ago

Description

This PR adds a simple feature to add instructor follow-ups to posts. Developed this because I require being able to use an account to post GPT answers to questions that TAs can approve, that should not be visible to students. Hence the need for an instructor follow-up. May be too trivial to include in the API, but thought it would be useful as EdTech and GenAI use cases become more popular on course forums.

Usage This simple program demonstrates how to use the create_followup() function to add a follow-up that is only visible to instructors:

from piazza_api import Piazza

# Instantiate a Piazza object
p = Piazza()

# Login to Piazza
p.user_login(email="XYZ@uni.edu", password="ABC123")

# Connect to the class
class_id = "PiazzaClassID"  
network = p.network(class_id)

# Get the post
post_number = 123
post = network.get_post(post_number)

# Create a follow-up
followup_content = "This is a follow-up post."
network.create_followup(post, followup_content, instructor=True)

Here is an example:

image