Group¶
-
class
canvasapi.group.
Group
(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_discussion_topic
(**kwargs)¶ Creates a new discussion topic for the course or group.
Calls: POST /api/v1/groups/:group_id/discussion_topics Return type: canvasapi.discussion_topic.DiscussionTopic
-
create_external_feed
(url, **kwargs)¶ Create a new external feed for the group.
Calls: POST /api/v1/groups/:group_id/external_feeds Parameters: url (str) – The urlof the external rss or atom feed Return type: canvasapi.external_feed.ExternalFeed
-
create_folder
(name, **kwargs)¶ Creates a folder in this group.
Calls: POST /api/v1/groups/:group_id/folders Parameters: name (str) – The name of the folder. Return type: canvasapi.folder.Folder
-
create_membership
(user, **kwargs)¶ Join, or request to join, a group, depending on the join_level of the group. If the membership or join request already exists, then it is simply returned.
Calls: POST /api/v1/groups/:group_id/memberships Parameters: user ( canvasapi.user.User
or int) – The object or ID of the user.Return type: canvasapi.group.GroupMembership
-
create_page
(wiki_page, **kwargs)¶ Create a new wiki page.
Calls: POST /api/v1/groups/:group_id/pages Parameters: wiki_page (dict) – Details about the page to create. Returns: The created page. Return type: canvasapi.page.Page
-
delete
()¶ Delete a group.
Calls: DELETE /api/v1/groups/:group_id Return type: canvasapi.group.Group
-
delete_external_feed
(feed)¶ Deletes the external feed.
Calls: DELETE /api/v1/groups/:group_id/external_feeds/:external_feed_id Parameters: feed ( canvasapi.external_feed.ExternalFeed
or int) – The object or id of the feed to be deleted.Return type: canvasapi.external_feed.ExternalFeed
-
edit
(**kwargs)¶ Edit a group.
Calls: PUT /api/v1/groups/:group_id Return type: canvasapi.group.Group
-
edit_front_page
(**kwargs)¶ Update the title or contents of the front page.
Calls: PUT /api/v1/groups/:group_id/front_page Return type: canvasapi.page.Page
-
get_activity_stream_summary
()¶ Return a summary of the current user’s global activity stream.
Calls: GET /api/v1/groups/:group_id/activity_stream/summary Return type: dict
-
get_discussion_topic
(topic)¶ Return data on an individual discussion topic.
Calls: GET /api/v1/groups/:group_id/discussion_topics/:topic_id Parameters: topic ( canvasapi.discussion_topic.DiscussionTopic
or 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/groups/:group_id/discussion_topics Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.discussion_topic.DiscussionTopic
-
get_file
(file, **kwargs)¶ Return the standard attachment json object for a file.
Calls: GET /api/v1/groups/:group_id/files/:id Parameters: file ( canvasapi.file.File
or int) – The object or ID of the file to retrieve.Return type: canvasapi.file.File
-
get_folder
(folder)¶ Returns the details for a group’s folder
Calls: GET /api/v1/groups/:group_id/folders/:id Parameters: folder ( canvasapi.folder.Folder
or 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/groups/:group_id/discussion_topics/:topic_id/view Parameters: topic ( canvasapi.discussion_topic.DiscussionTopic
or int) – The object or ID of the discussion topic.Return type: dict
-
get_membership
(user, membership_type)¶ List users in a group.
Calls: Parameters: user (
canvasapi.user.User
or int) – list of user idsReturn type:
-
get_page
(url)¶ Retrieve the contents of a wiki page.
Calls: GET /api/v1/groups/:group_id/pages/:url Parameters: url (str) – The url for the page. Returns: The specified page. Return type: canvasapi.groups.Group
-
get_pages
(**kwargs)¶ List the wiki pages associated with a group.
Calls: GET /api/v1/groups/:group_id/pages Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.page.Page
-
invite
(invitees)¶ Invite users to group.
Calls: POST /api/v1/groups/:group_id/invite Parameters: invitees (integer list) – list of user ids Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.group.GroupMembership
-
list_external_feeds
()¶ Returns the list of External Feeds this group.
Calls: GET /api/v1/groups/:group_id/external_feeds Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.external_feed.ExternalFeed
-
list_files
(**kwargs)¶ Returns the paginated list of files for the group.
Calls: GET api/v1/groups/:group_id/files Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.file.File
-
list_folders
()¶ Returns the paginated list of all folders for the given group. This will be returned as a flat list containing all subfolders as well.
Calls: GET /api/v1/groups/:group_id/folders Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.folder.Folder
-
list_memberships
(**kwargs)¶ List users in a group.
Calls: GET /api/v1/groups/:group_id/memberships Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.group.GroupMembership
-
list_tabs
(**kwargs)¶ List available tabs for a group. Returns a list of navigation tabs available in the current context.
Calls: GET /api/v1/groups/:group_id/tabs Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.tab.Tab
-
list_users
(**kwargs)¶ List users in a group.
Calls: GET /api/v1/groups/:group_id/users Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.user.User
-
preview_html
(html)¶ Preview HTML content processed for this course.
Calls: POST /api/v1/groups/:group_id/preview_html Parameters: html (str) – The HTML code to preview. Return type: str
-
remove_user
(user)¶ Leave a group if allowed.
Calls: DELETE /api/v1/groups/:group_id/:type/:id Parameters: user ( canvasapi.user.User
or int) – The user object or ID to remove from the group.Return type: canvasapi.user.User
-
reorder_pinned_topics
(order)¶ Puts the pinned discussion topics in the specified order. All pinned topics should be included.
Calls: POST /api/v1/groups/:group_id/discussion_topics/reorder Parameters: order (iterable sequence of values) – The ids of the pinned discussion topics in the desired order. e.g. [104, 102, 103] Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.discussion_topic.DiscussionTopic
-
show_front_page
()¶ Retrieve the content of the front page.
Calls: GET /api/v1/groups/:group_id/front_page Return type: canvasapi.group.Group
-
update_membership
(user, **kwargs)¶ Accept a membership request, or add/remove moderator rights.
Calls: PUT /api/v1/groups/:group_id/users/:user_id Parameters: user ( canvasapi.user.User
or int) – The object or ID of the user.Return type: canvasapi.group.GroupMembership
-
upload
(file, **kwargs)¶ Upload a file to the group. Only those with the ‘Manage Files’ permission on a group can upload files to the group. By default, this is anybody participating in the group, or any admin over the group.
Calls: Parameters: - path (str) – The path of the file to upload.
- 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 (
GroupMembership¶
-
class
canvasapi.group.
GroupMembership
(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_self
()¶ Leave a group if allowed.
Calls: DELETE /api/v1/groups/:group_id/:type/:id Returns: An empty dictionary Return type: dict
-
remove_user
(user)¶ Remove user from membership.
Calls: DELETE /api/v1/groups/:group_id/:type/:id Parameters: user ( canvasapi.user.User
or int) – The user object or ID to remove from the group.Returns: An empty dictionary Return type: dict
-
update
(**kwargs)¶ Accept a membership request, or add/remove moderator rights.
Calls: PUT /api/v1/groups/:group_id/memberships/:membership_id Return type: canvasapi.group.GroupMembership
- requester (
GroupCategory¶
-
class
canvasapi.group.
GroupCategory
(requester, attributes)¶ Parameters: - requester (
canvasapi.requester.Requester
) – The requester to pass HTTP requests through. - attributes (dict) – The JSON object to build this object with.
-
assign_members
(sync=False)¶ Assign unassigned members.
Calls: POST /api/v1/group_categories/:group_category_id/assign_unassigned_members Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.user.User
orcanvasapi.progress.Progress
-
create_group
(**kwargs)¶ Create a group.
Calls: POST /api/v1/group_categories/:group_category_id/groups Return type: canvasapi.group.Group
-
delete
()¶ Delete a group category.
Calls: DELETE /api/v1/group_categories/:group_category_id Return type: empty dict
-
list_groups
()¶ List groups in group category.
Calls: GET /api/v1/group_categories/:group_category_id/groups Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.group.Group
-
list_users
(**kwargs)¶ List users in group category.
Calls: GET /api/v1/group_categories/:group_category_id/users Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.user.User
-
update
(**kwargs)¶ Update a group category.
Calls: PUT /api/v1/group_categories/:group_category_id Return type: canvasapi.group.GroupCategory
- requester (