# list all current group category
list(cg.get_group_categories().keys())['Final Project', 'Student Groups', 'Test']
CanvasGroup (credentials_fp='', API_URL='https://canvas.ucsd.edu', course_id='', group_category='', verbosity=1)
Initialize Canvas Group within a Group Set and its appropriate memberships
| Type | Default | Details | |
|---|---|---|---|
| credentials_fp | str | credential file path. Template of the credentials.json | |
| API_URL | str | https://canvas.ucsd.edu | the domain name of canvas |
| course_id | str | Course ID, can be found in the course url | |
| group_category | str | target group category (set) of interests | |
| verbosity | int | 1 | Controls the verbosity: 0 = Silent, 1 = print all messages |
Alternatively, you can manually set them after you created the CanvasGroup object
CanvasGroup.auth_canvas (credentials_fp:str)
Authorize the canvas module with API_KEY
| Type | Details | |
|---|---|---|
| credentials_fp | str | the Authenticator key generated from canvas |
CanvasGroup.set_course (course_id:int)
Set the target course by the course ID
| Type | Details | |
|---|---|---|
| course_id | int | the course id of the target course |
The following tutorial and examples demonstrates how to create and set a Group Category within a course context.
CanvasGroup.get_group_categories ()
Grab all existing group categories (group set) in this course
['Final Project', 'Student Groups', 'Test']
CanvasGroup.create_group_category (params:dict)
Create group category (group set) in this course
| Type | Details | |
|---|---|---|
| params | dict | the parameter of canvas group category API @ this link |
| Returns | GroupCategory | the generated group category object |
['Final Project', 'Student Groups', 'Test', 'TEST-GroupProject']
When a group category is already created, we cannot create another group with the same name. To switch the group category destination of group creation, use the set_group_category methods.
CanvasGroup.set_group_category (category_name:str)
| Type | Details | |
|---|---|---|
| category_name | str | the target group category |
| Returns | GroupCategory | target group category object |
CanvasGroup.create_group (params:dict)
Create canvas group under the target group category
| Type | Details | |
|---|---|---|
| params | dict | the parameter of canvas group create API at this link |
| Returns | Group | the generated target group object |
CanvasGroup.join_canvas_group (group:canvasapi.group.Group, group_members:[<class'str'>])
Add membership access of each group member into the group
| Type | Details | |
|---|---|---|
| group | Group | the group that students will join |
| group_members | [<class ‘str’>] | list of group member’s SIS Login (email prefix, before the @.) |
| Returns | [<class ‘str’>] | list of unsuccessful join |