Assignment
- class canvasapi.assignment.Assignment(requester, attributes)
- Parameters:
requester (
canvasapi.requester.Requester) – The requester to pass HTTP requests through.attributes (dict) – The JSON object to build this object with.
- create_override(**kwargs)
Create an override for this assignment.
- delete(**kwargs)
Delete this assignment.
- Calls:
- Return type:
- edit(**kwargs)
Modify this assignment.
- Calls:
- Return type:
- get_grade_change_events(**kwargs)
Returns the grade change events for the assignment.
- get_gradeable_students(**kwargs)
List students eligible to submit the assignment.
- Calls:
GET /api/v1/courses/:course_id/assignments/:assignment_id/gradeable_students
- Return type:
canvasapi.paginated_list.PaginatedListofcanvasapi.user.UserDisplay
- get_override(override, **kwargs)
Get a single assignment override with the given override id.
- Calls:
GET /api/v1/courses/:course_id/assignments/:assignment_id/overrides/:id
- Parameters:
override (
canvasapi.assignment.AssignmentOverrideor int) – The object or ID of the override to get- Return type:
- get_overrides(**kwargs)
Get a paginated list of overrides for this assignment that target sections/groups/students visible to the current user.
- get_peer_reviews(**kwargs)
Get a list of all Peer Reviews for this assignment.
- Calls:
GET /api/v1/courses/:course_id/assignments/:assignment_id/peer_reviews
- Return type:
canvasapi.paginated_list.PaginatedListofcanvasapi.peer_review.PeerReview
- get_provisional_grades_status(student_id, **kwargs)
Tell whether the student’s submission needs one or more provisional grades.
- Calls:
GET /api/v1/courses/:course_id/assignments/:assignment_id/provisional_grades/ status
- Parameters:
student_id (
canvasapi.user.Useror int) – The object or ID of the related student- Return type:
bool
- get_students_selected_for_moderation(**kwargs)
Get a list of students selected for moderation.
- get_submission(user, **kwargs)
Get a single submission, based on user id.
- Calls:
GET /api/v1/courses/:course_id/assignments/:assignment_id/submissions/:user_id
- Parameters:
user (
canvasapi.user.Useror int) – The object or ID of the related user- Return type:
- get_submissions(**kwargs)
Get all existing submissions for this assignment.
- publish_provisional_grades(**kwargs)
Publish the selected provisional grade for all submissions to an assignment. Use the “Select provisional grade” endpoint to choose which provisional grade to publish for a particular submission.
Students not in the moderation set will have their one and only provisional grade published.
WARNING: This is irreversible. This will overwrite existing grades in the gradebook.
- Calls:
POST /api/v1/courses/:course_id/assignments/:assignment_id/provisional_grades /publish
- Return type:
dict
- select_students_for_moderation(**kwargs)
Select student(s) for moderation.
- Calls:
POST /api/v1/courses/:course_id/assignments/:assignment_id/moderated_students
- Returns:
The list of users that were selected
- Return type:
canvasapi.paginated_list.PaginatedListofcanvasapi.user.User
- selected_provisional_grade(provisional_grade_id, **kwargs)
Choose which provisional grade the student should receive for a submission. The caller must be the final grader for the assignment or an admin with :select_final_grade rights.
- Calls:
- Parameters:
provisional_grade_id (int) – ID of the provisional grade
- Return type:
dict
- set_extensions(assignment_extensions, **kwargs)
Set extensions for student assignment submissions
- Calls:
POST /api/v1/courses/:course_id/assignments/:assignment_id/extensions
- Parameters:
assignment_extensions (list) – list of dictionaries representing extensions
- Return type:
Example Usage:
>>> assignment.set_extensions([ ... { ... 'user_id': 3, ... 'extra_attempts': 2 ... }, ... { ... 'user_id': 2, ... 'extra_attempts': 2 ... } ... ])
- show_provisonal_grades_for_student(anonymous_id, **kwargs)
- Call:
GET /api/v1/courses/:course_id/assignments/:assignment_id/ anonymous_provisional_grades/status
- Parameters:
anonymous_id (
canvasapi.user.Useror int) – The ID of the student to show the status for- Return type:
dict
- submissions_bulk_update(**kwargs)
Update the grading and comments on multiple student’s assignment submissions in an asynchronous job.
- submit(submission, file=None, **kwargs)
Makes a submission for an assignment.
- Calls:
POST /api/v1/courses/:course_id/assignments/:assignment_id/submissions
- Parameters:
submission (dict) – The attributes of the submission.
file (file or str) – A file to upload with the submission. (Optional, defaults to None. Submission type must be online_upload)
- Return type:
- upload_to_submission(file: PathLike | str | IOBase | FileIO, user='self', **kwargs)
Upload a file to a submission.
- Calls:
POST /api/v1/courses/:course_id/assignments/:assignment_id/ submissions/:user_id/files
- Parameters:
file (FileLike) – The file or path of the file to upload.
user (
canvasapi.user.User, int, or str) – The object or ID of the related user, or ‘self’ for the current user. Defaults to ‘self’.
- Returns:
True if the file uploaded successfully, False otherwise, and the JSON response from the API.
- Return type:
tuple
AssignmentExtension
- class canvasapi.assignment.AssignmentExtension(requester, attributes)
- Parameters:
requester (
canvasapi.requester.Requester) – The requester to pass HTTP requests through.attributes (dict) – The JSON object to build this object with.
AssignmentGroup
- class canvasapi.assignment.AssignmentGroup(requester, attributes)
- Parameters:
requester (
canvasapi.requester.Requester) – The requester to pass HTTP requests through.attributes (dict) – The JSON object to build this object with.
- delete(**kwargs)
Delete this assignment.
- edit(**kwargs)
Modify this assignment group.
AssignmentOverride
- class canvasapi.assignment.AssignmentOverride(requester, attributes)
- Parameters:
requester (
canvasapi.requester.Requester) – The requester to pass HTTP requests through.attributes (dict) – The JSON object to build this object with.
- delete(**kwargs)
Delete this assignment override.
- Calls:
DELETE /api/v1/courses/:course_id/assignments/:assignment_id/overrides/:id
- Returns:
The previous content of the now-deleted assignment override.
- Return type:
- edit(**kwargs)
Update this assignment override.
Note: All current overridden values must be supplied if they are to be retained.