Last active
March 13, 2022 20:09
-
-
Save jlumbroso/7d79c605d28653b1cd7a5ddb8db877a1 to your computer and use it in GitHub Desktop.
codePost snippet to automatically finalize all submissions of an assignment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the codePost Python SDK must be installed: pip install codepost | |
import codepost | |
# variable parameters | |
# get the API key here: https://codepost.io/settings | |
API_KEY = "... see above where to get this ..." | |
COURSE_NAME = "COS126" | |
COURSE_TERM = "S2022" | |
ASSIGNMENT = "Programming Exam 1" | |
# authenticate | |
codepost.configure_api_key(API_KEY) | |
# retrieve the course, and then the assignment | |
# (will crash if the user of the API key doesn't have access to the course) | |
course = codepost.course.list_available(name=COURSE_NAME, period=COURSE_TERM)[0] | |
assignment = course.assignments.by_name(name=ASSIGNMENT) | |
# iterate over all submissions | |
for submission in assignment.list_submissions(): | |
# claim submission (must assign a grader, here I assign myself) | |
submission.grader = "lumbroso@princeton.edu" | |
# finalize the submission | |
# (so it is visible to students, once the assignment is "published") | |
submission.isFinalized = True | |
# save changes | |
submission.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read more about this snippet in the corresponding Medium article:
https://medium.com/@jeremie.lumbroso/how-to-automatically-finalize-all-submissions-in-codepost-6650badfeed7