Assignment

class canvasapi.assignment.Assignment(requester, attributes)
create_override(**kwargs)

Create an override for this assignment.

Calls:POST /api/v1/courses/:course_id/assignments/:assignment_id/overrides
Return type:canvasapi.assignment.AssignmentOverride
delete(**kwargs)

Delete this assignment.

Calls:DELETE /api/v1/courses/:course_id/assignments/:id
Return type:canvasapi.assignment.Assignment
edit(**kwargs)

Modify this assignment.

Calls:PUT /api/v1/courses/:course_id/assignments/:id
Return type:canvasapi.assignment.Assignment
get_grade_change_events(**kwargs)

Returns the grade change events for the assignment.

Calls:/api/v1/audit/grade_change/assignments/:assignment_id
Return type:canvasapi.paginated_list.PaginatedList of canvasapi.grade_change_log.GradeChangeEvent
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.PaginatedList of canvasapi.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.AssignmentOverride or int) – The object or ID of the override to get
Return type:canvasapi.assignment.AssignmentOverride
get_overrides(**kwargs)

Get a paginated list of overrides for this assignment that target sections/groups/students visible to the current user.

Calls:GET /api/v1/courses/:course_id/assignments/:assignment_id/overrides
Return type:canvasapi.paginated_list.PaginatedList of canvasapi.assignment.AssignmentOverride
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.PaginatedList of canvasapi.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.User or int) – The object or ID of the related student
Return type:bool
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.User or int) – The object or ID of the related user
Return type:canvasapi.submission.Submission
get_submissions(**kwargs)

Get all existing submissions for this assignment.

Calls:GET /api/v1/courses/:course_id/assignments/:assignment_id/submissions
Return type:canvasapi.paginated_list.PaginatedList of canvasapi.submission.Submission
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
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:PUT /api/v1/courses/:course_id/assignments/:assignment_id/provisional_grades/ :provisonal_grade_id/select
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:list of canvasapi.assignment.AssignmentExtension

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.User or 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.

Calls:POST /api/v1/courses/:course_id/assignments/:assignment_id/ submissions/update_grades
Return type:canvasapi.progress.Progress
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:

canvasapi.submission.Submission

upload_to_submission(file: Union[os.PathLike, str, io.IOBase, _io.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.

Calls:DELETE /api/v1/courses/:course_id/assignment_groups/:assignment_group_id
Return type:canvasapi.assignment.AssignmentGroup
edit(**kwargs)

Modify this assignment group.

Calls:PUT /api/v1/courses/:course_id/assignment_groups/:assignment_group_id
Return type:canvasapi.assignment.AssignmentGroup