Course¶
-
class
canvasapi.course.Course(requester, attributes)¶ Parameters: - requester (
canvasapi.requester.Requester) – The requester to pass HTTP requests through. - attributes (dict) – The JSON object to build this object with.
-
add_grading_standards(title, grading_scheme_entry, **kwargs)¶ Create a new grading standard for the course.
Calls: Parameters: - title (str) – The title for the Grading Standard
- grading_scheme (list[dict]) – A list of dictionaries containing keys for “name” and “value”
Return type: canvasapi.grading_standards.GradingStandard
-
conclude()¶ Mark this course as concluded.
Calls: DELETE /api/v1/courses/:id Returns: True if the course was concluded, False otherwise. Return type: bool
-
create_assignment(assignment, **kwargs)¶ Create a new assignment for this course.
Note: The assignment is created in the active state.
Calls: POST /api/v1/courses/:course_id/assignments Parameters: assignment (dict) – The attributes of the assignment Return type: canvasapi.assignment.Assignment
-
create_assignment_group(**kwargs)¶ Create a new assignment group for this course.
Calls: POST /api/v1/courses/:course_id/assignment_groups Return type: canvasapi.assignment.AssignmentGroup
-
create_course_section(**kwargs)¶ Create a new section for this course.
Calls: POST /api/v1/courses/:course_id/sections Return type: canvasapi.course.Section
-
create_discussion_topic(**kwargs)¶ Creates a new discussion topic for the course or group.
Calls: POST /api/v1/courses/:course_id/discussion_topics Return type: canvasapi.discussion_topic.DiscussionTopic
-
create_external_feed(url, **kwargs)¶ Create a new external feed for the course.
Calls: POST /api/v1/courses/:course_id/external_feeds Parameters: url (str) – The url of the external rss or atom feed Return type: canvasapi.external_feed.ExternalFeed
-
create_external_tool(name, privacy_level, consumer_key, shared_secret, **kwargs)¶ Create an external tool in the current course.
Calls: Parameters: - name (str) – The name of the tool
- privacy_level (str) – What information to send to the external tool. Options are “anonymous”, “name_only”, “public”
- consumer_key (str) – The consumer key for the external tool
- shared_secret (str) – The shared secret with the external tool
Return type:
-
create_folder(name, **kwargs)¶ Creates a folder in this course.
Calls: POST /api/v1/courses/:course_id/folders Parameters: name (str) – The name of the folder. Return type: canvasapi.folder.Folder
-
create_group_category(name, **kwargs)¶ Create a group category.
Calls: POST /api/v1/courses/:course_id/group_categories Parameters: name (str) – Name of the category. Return type: canvasapi.group.GroupCategory
-
create_module(module, **kwargs)¶ Create a new module.
Calls: POST /api/v1/courses/:course_id/modules Parameters: module (dict) – The attributes for the module. Returns: The created module. Return type: canvasapi.module.Module
-
create_page(wiki_page, **kwargs)¶ Create a new wiki page.
Calls: POST /api/v1/courses/:course_id/pages Parameters: title (dict) – The title for the page. Returns: The created page. Return type: canvasapi.course.Course
-
create_quiz(quiz, **kwargs)¶ Create a new quiz in this course.
Calls: POST /api/v1/courses/:course_id/quizzes Parameters: quiz (dict) – The attributes for the quiz. Return type: canvasapi.quiz.Quiz
-
delete()¶ Permanently delete this course.
Calls: DELETE /api/v1/courses/:id Returns: True if the course was deleted, False otherwise. Return type: bool
-
delete_external_feed(feed)¶ Deletes the external feed.
Calls: DELETE /api/v1/courses/:course_id/external_feeds/:external_feed_id Parameters: feed ( canvasapi.external_feed.ExternalFeedor int) – The object or ID of the feed to be deleted.Return type: canvasapi.external_feed.ExternalFeed
-
edit_front_page(**kwargs)¶ Update the title or contents of the front page.
Calls: PUT /api/v1/courses/:course_id/front_page Return type: canvasapi.course.Course
-
enroll_user(user, enrollment_type, **kwargs)¶ Create a new user enrollment for a course or a section.
Calls: Parameters: - user (
canvasapi.user.Useror int) – The object or ID of the user to enroll in this course. - enrollment_type (str) – The type of enrollment.
Return type: canvasapi.enrollment.Enrollment- user (
-
get_all_outcome_links_in_context()¶ Get all outcome links for context - BETA
Calls: GET /api/v1/courses/:course_id/outcome_group_links Returns: Paginated List of OutcomesLinks in the context. Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.outcome.OutcomeLink
-
get_assignment(assignment, **kwargs)¶ Return the assignment with the given ID.
Calls: GET /api/v1/courses/:course_id/assignments/:id Parameters: assignment ( canvasapi.assignment.Assignmentor int) – The object or ID of the assignment to retrieve.Return type: canvasapi.assignment.Assignment
-
get_assignment_group(assignment_group, **kwargs)¶ Retrieve specified assignment group for the specified course.
Calls: GET /api/v1/courses/:course_id/assignment_groups/:assignment_group_id Parameters: assignment_group ( canvasapi.assignment.AssignmentGroupor int) – object or ID of assignment group.Return type: canvasapi.assignment.AssignmentGroup
-
get_assignments(**kwargs)¶ List all of the assignments in this course.
Calls: GET /api/v1/courses/:course_id/assignments Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.assignment.Assignment
-
get_course_level_assignment_data(**kwargs)¶ Return a list of assignments for the course sorted by due date
Calls: GET /api/v1/courses/:course_id/analytics/assignments Return type: dict
-
get_course_level_participation_data()¶ Return page view hits and participation numbers grouped by day through the course’s history
Calls: GET /api/v1/courses/:course_id/analytics/activity Return type: dict
-
get_course_level_student_summary_data(**kwargs)¶ Return a summary of per-user access information for all students in a course
Calls: GET /api/v1/courses/:course_id/analytics/student_summaries Return type: dict
-
get_discussion_topic(topic)¶ Return data on an individual discussion topic.
Calls: GET /api/v1/courses/:course_id/discussion_topics/:topic_id Parameters: topic ( canvasapi.discussion_topic.DiscussionTopicor int) – The object or ID of the discussion topic.Return type: canvasapi.discussion_topic.DiscussionTopic
-
get_discussion_topics(**kwargs)¶ Returns the paginated list of discussion topics for this course or group.
Calls: GET /api/v1/courses/:course_id/discussion_topics Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.discussion_topic.DiscussionTopic
-
get_enrollments(**kwargs)¶ List all of the enrollments in this course.
Calls: GET /api/v1/courses/:course_id/enrollments Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.enrollment.Enrollment
-
get_external_tool(tool)¶ Calls: GET /api/v1/courses/:course_id/external_tools/:external_tool_id Parameters: tool ( canvasapi.external_tool.ExternalToolor int) – The object or ID of the tool to retrieve.Return type: canvasapi.external_tool.ExternalTool
-
get_external_tools(**kwargs)¶ Calls: GET /api/v1/courses/:course_id/external_tools Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.external_tool.ExternalTool
-
get_file(file, **kwargs)¶ Return the standard attachment json object for a file.
Calls: GET /api/v1/courses/:course_id/files/:id Parameters: file ( canvasapi.file.Fileor int) – The object or ID of the file to retrieve.Return type: canvasapi.file.File
-
get_folder(folder)¶ Returns the details for a course folder
Calls: GET /api/v1/courses/:course_id/folders/:id Parameters: folder ( canvasapi.folder.Folderor int) – The object or ID of the folder to retrieve.Return type: canvasapi.folder.Folder
-
get_full_discussion_topic(topic)¶ Return a cached structure of the discussion topic.
Calls: GET /api/v1/courses/:course_id/discussion_topics/:topic_id/view Parameters: topic ( canvasapi.discussion_topic.DiscussionTopicor int) – The object or ID of the discussion topic.Return type: dict
-
get_grading_standards(**kwargs)¶ Get a PaginatedList of the grading standards available for the course
Calls: GET /api/v1/courses/:course_id/grading_standards Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.grading_standards.GradingStandard
-
get_module(module, **kwargs)¶ Retrieve a single module by ID.
Calls: GET /api/v1/courses/:course_id/modules/:id Parameters: module ( canvasapi.module.Moduleor int) – The object or ID of the module to retrieve.Return type: canvasapi.module.Module
-
get_modules(**kwargs)¶ Return a list of modules in this course.
Calls: GET /api/v1/courses/:course_id/modules Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.module.Module
-
get_outcome_group(group)¶ Returns the details of the Outcome Group with the given id.
Calls: GET /api/v1/courses/:course_id/outcome_groups/:id Parameters: group ( canvasapi.outcome.OutcomeGroupor int) – The outcome group object or ID to return.Returns: An outcome group object. Return type: canvasapi.outcome.OutcomeGroup
-
get_outcome_groups_in_context()¶ Get all outcome groups for context - BETA
Calls: GET /api/v1/courses/:course_id/outcome_groups Returns: Paginated List of OutcomesGroups in the context. Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.outcome.OutcomeGroups
-
get_outcome_result_rollups(**kwargs)¶ Get all outcome result rollups for context - BETA
Calls: GET /api/v1/courses/:course_id/outcome_rollups Returns: List of outcome result rollups in the context. Return type: dict
-
get_outcome_results(**kwargs)¶ Get all outcome results for context - BETA
Calls: GET /api/v1/courses/:course_id/outcome_results Returns: List of potential related outcome result dicts. Return type: dict
-
get_page(url)¶ Retrieve the contents of a wiki page.
Calls: GET /api/v1/courses/:course_id/pages/:url Parameters: url (str) – The url for the page. Returns: The specified page. Return type: canvasapi.course.Course
-
get_pages(**kwargs)¶ List the wiki pages associated with a course.
Calls: GET /api/v1/courses/:course_id/pages Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.course.Course
-
get_quiz(quiz)¶ Return the quiz with the given id.
Calls: GET /api/v1/courses/:course_id/quizzes/:id Parameters: quiz ( canvasapi.quiz.Quizor int) – The object or ID of the quiz to retrieve.Return type: canvasapi.quiz.Quiz
-
get_quizzes(**kwargs)¶ Return a list of quizzes belonging to this course.
Calls: GET /api/v1/courses/:course_id/quizzes Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.quiz.Quiz
-
get_recent_students()¶ Return a list of students in the course ordered by how recently they have logged in.
Calls: GET /api/v1/courses/:course_id/recent_students Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.user.User
-
get_root_outcome_group()¶ Redirect to root outcome group for context
Calls: GET /api/v1/courses/:course_id/root_outcome_group Returns: The OutcomeGroup of the context. Return type: canvasapi.outcome.OutcomeGroup
-
get_rubric(rubric_id, **kwargs)¶ Get a single rubric, based on rubric id.
Calls: GET /api/v1/courses/:course_id/rubrics/:id Parameters: rubric_id (int) – The ID of the rubric. Return type: canvasapi.rubric.Rubric
-
get_section(section)¶ Retrieve a section.
Calls: GET /api/v1/courses/:course_id/sections/:id Parameters: section ( canvasapi.section.Sectionor int) – The object or ID of the section to retrieve.Return type: canvasapi.section.Section
-
get_settings()¶ Returns this course’s settings.
Calls: GET /api/v1/courses/:course_id/settings Return type: dict
-
get_single_grading_standard(grading_standard_id, **kwargs)¶ Get a single grading standard from the course.
Calls: GET /api/v1/courses/:course_id/grading_standards/:grading_standard_id Parameters: grading_standard_id (int) – The grading standard id Return type: canvasapi.grading_standards.GradingStandard
-
get_submission(assignment, user, **kwargs)¶ Get a single submission, based on user id.
Calls: GET /api/v1/courses/:course_id/assignments/:assignment_id/submissions/:user_id
Parameters: - assignment (
canvasapi.assignment.Assignmentor int) – The object or ID of the related assignment - user (
canvasapi.user.Useror int) – The object or ID of the related user
Return type: - assignment (
-
get_user(user, user_id_type=None)¶ Retrieve a user by their ID. user_id_type denotes which endpoint to try as there are several different ids that can pull the same user record from Canvas.
Calls: Parameters: - user (
canvasapi.user.Useror int) – The object or ID of the user to retrieve. - user_id_type (str) – The type of the ID to search for.
Return type: - user (
-
get_user_in_a_course_level_assignment_data(user)¶ Return a list of assignments for the course sorted by due date
Calls: GET /api/v1/courses/:course_id/analytics/users/:student_id/assignments Parameters: user ( canvasapi.user.Useror int) – The object or ID of the related userReturn type: dict
-
get_user_in_a_course_level_messaging_data(user)¶ Return messaging hits grouped by day through the entire history of the course
Calls: GET /api/v1/courses/:course_id/analytics/users/:student_id/communication Parameters: user ( canvasapi.user.Useror int) – The object or ID of the related userReturn type: dict
-
get_user_in_a_course_level_participation_data(user)¶ Return page view hits grouped by hour and participation details through course’s history
Calls: GET /api/v1/courses/:course_id/analytics/users/:student_id/activity Parameters: user ( canvasapi.user.Useror int) – The object or ID of the related userReturn type: dict
-
get_users(**kwargs)¶ List all users in a course.
Calls: GET /api/v1/courses/:course_id/search_users Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.user.User
-
list_assignment_groups(**kwargs)¶ List assignment groups for the specified course.
Calls: GET /api/v1/courses/:course_id/assignment_groups Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.assignment.AssignmentGroup
-
list_external_feeds()¶ Returns the list of External Feeds this course.
Calls: GET /api/v1/courses/:course_id/external_feeds Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.external_feed.ExternalFeed
-
list_files(**kwargs)¶ Returns the paginated list of files for the course.
Calls: GET api/v1/courses/:course_id/files Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.file.File
-
list_folders()¶ Returns the paginated list of all folders for the given course. This will be returned as a flat list containing all subfolders as well.
Calls: GET /api/v1/courses/:course_id/folders Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.folder.Folder
-
list_gradeable_students(assignment)¶ List students eligible to submit the assignment.
Calls: GET /api/v1/courses/:course_id/assignments/:assignment_id/gradeable_students Parameters: assignment ( canvasapi.assignment.Assignmentor int) – The object or ID of the related assignmentReturn type: canvasapi.paginated_list.PaginatedListofcanvasapi.user.User
-
list_group_categories()¶ List group categories for a context.
Calls: GET /api/v1/courses/:course_id/group_categories Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.group.GroupCategory
-
list_groups(**kwargs)¶ Return list of active groups for the specified course.
Calls: GET /api/v1/courses/:course_id/groups Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.course.Course
-
list_multiple_submissions(**kwargs)¶ List submissions for multiple assignments. Get all existing submissions for a given set of students and assignments.
Calls: GET /api/v1/courses/:course_id/students/submissions Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.submission.Submission
-
list_rubrics(**kwargs)¶ Get the paginated list of active rubrics for the current course.
Calls: GET /api/v1/courses/:course_id/rubrics Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.rubric.Rubric
-
list_sections(**kwargs)¶ Returns the list of sections for this course.
Calls: GET /api/v1/courses/:course_id/sections Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.section.Section
-
list_submissions(assignment, **kwargs)¶ Get all existing submissions for an assignment.
Calls: GET /api/v1/courses/:course_id/assignments/:assignment_id/submissions Parameters: assignment ( canvasapi.assignment.Assignmentor int) – The object or ID of the related assignmentReturn type: canvasapi.paginated_list.PaginatedListofcanvasapi.submission.Submission
-
list_tabs(**kwargs)¶ List available tabs for a course. Returns a list of navigation tabs available in the current context.
Calls: GET /api/v1/courses/:course_id/tabs Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.tab.Tab
-
mark_submission_as_read(assignment, user)¶ Mark submission as read. No request fields are necessary.
Calls: PUT /api/v1/courses/:course_id/assignments/:assignment_id/submissions/:user_id/read
Parameters: - assignment (
canvasapi.assignment.Assignmentor int) – The object or ID of the related assignment - user (
canvasapi.user.Useror int) – The object or ID of the related user
Return type: bool
- assignment (
-
mark_submission_as_unread(assignment, user)¶ Mark submission as unread. No request fields are necessary.
Calls: DELETE /api/v1/courses/:course_id/assignments/:assignment_id/submissions/:user_id/read
Parameters: - assignment (
canvasapi.assignment.Assignmentor int) – The object or ID of the related assignment - user (
canvasapi.user.Useror int) – The object or ID of the related user
Return type: bool
- assignment (
-
preview_html(html)¶ Preview HTML content processed for this course.
Calls: POST /api/v1/courses/:course_id/preview_html Parameters: html (str) – The HTML code to preview. Return type: str
-
reorder_pinned_topics(order)¶ Puts the pinned discussion topics in the specified order. All pinned topics should be included.
Calls: POST /api/v1/courses/:course_id/discussion_topics/reorder Parameters: order (string or iterable sequence of values) – The ids of the pinned discussion topics in the desired order. e.g. [104, 102, 103], (104, 102, 103), or “104,102,103” Return type: canvasapi.paginated_list.PaginatedListofcanvasapi.discussion_topic.DiscussionTopic
-
reset()¶ Delete the current course and create a new equivalent course with no content, but all sections and users moved over.
Calls: POST /api/v1/courses/:course_id/reset_content Return type: canvasapi.course.Course
-
show_front_page()¶ Retrieve the content of the front page.
Calls: GET /api/v1/courses/:course_id/front_page Return type: canvasapi.course.Course
-
submit_assignment(assignment, submission, **kwargs)¶ Makes a submission for an assignment.
Calls: POST /api/v1/courses/:course_id/assignments/:assignment_id/submissions
Parameters: - assignment (
canvasapi.assignment.Assignmentor int) – The object or ID of the related assignment - submission (dict) – The attributes of the submission.
Return type: - assignment (
-
update(**kwargs)¶ Update this course.
Calls: PUT /api/v1/courses/:id Returns: True if the course was updated, False otherwise. Return type: bool
-
update_settings(**kwargs)¶ Update a course’s settings.
Calls: PUT /api/v1/courses/:course_id/settings Return type: dict
-
update_submission(assignment, user, **kwargs)¶ Comment on and/or update the grading for a student’s assignment submission.
Calls: PUT /api/v1/courses/:course_id/assignments/:assignment_id/submissions/:user_id
Parameters: - assignment (
canvasapi.assignment.Assignmentor int) – The object or ID of the related assignment - user (
canvasapi.user.Useror int) – The object or ID of the related user
Return type: - assignment (
-
update_tab(tab_id, **kwargs)¶ Update a tab for a course.
Calls: PUT /api/v1/courses/:course_id/tabs/:tab_id Parameters: tab_id (str) – The ID of the tab Return type: canvasapi.tab.Tab
-
upload(file, **kwargs)¶ Upload a file to this course.
Calls: POST /api/v1/courses/:course_id/files Parameters: file (file or str) – The file or path of the file to upload. Returns: True if the file uploaded successfully, False otherwise, and the JSON response from the API. Return type: tuple
- requester (
CourseNickname¶
-
class
canvasapi.course.CourseNickname(requester, attributes)¶ Parameters: - requester (
canvasapi.requester.Requester) – The requester to pass HTTP requests through. - attributes (dict) – The JSON object to build this object with.
-
remove()¶ Remove the nickname for the given course. Subsequent course API calls will return the actual name for the course.
Calls: DELETE /api/v1/users/self/course_nicknames/:course_id Return type: canvasapi.course.CourseNickname
- requester (