CurrentUser

The canvasapi.current_user.CurrentUser class is a subclass of canvasapi.user.User, and thus also includes all of its methods.

Documentation for the User class

class canvasapi.current_user.CurrentUser(_requester)
Parameters:
  • requester (canvasapi.requester.Requester) – The requester to pass HTTP requests through.

  • attributes (dict) – The JSON object to build this object with.

add_favorite_course(course, use_sis_id=False, **kwargs)

Add a course to the current user’s favorites. If the course is already in the user’s favorites, nothing happens.

Calls:

POST /api/v1/users/self/favorites/courses/:id

Parameters:
  • course (canvasapi.course.Course or int) – The course or ID/SIS ID of the course.

  • use_sis_id (bool) – Whether or not course is an sis ID. Defaults to False.

Return type:

canvasapi.favorite.Favorite

add_favorite_group(group, use_sis_id=False, **kwargs)

Add a group to the current user’s favorites. If the group is already in the user’s favorites, nothing happens.

Calls:

POST /api/v1/users/self/favorites/groups/:id

Parameters:
  • group (canvasapi.group.Group or int) – The ID or SIS ID of the group.

  • use_sis_id (bool) – Whether or not group is an sis ID. Defaults to False.

Return type:

canvasapi.favorite.Favorite

create_bookmark(name, url, **kwargs)

Create a new Bookmark.

Calls:

POST /api/v1/users/self/bookmarks

Parameters:
  • name (str) – The name of the bookmark.

  • url (str) – The url of the bookmark.

Return type:

canvasapi.bookmark.Bookmark

get_bookmark(bookmark, **kwargs)

Return single Bookmark by id

Calls:

GET /api/v1/users/self/bookmarks/:id

Parameters:

bookmark (canvasapi.bookmark.Bookmark or int) – The object or ID of the bookmark.

Return type:

canvasapi.bookmark.Bookmark

get_bookmarks(**kwargs)

List bookmarks that the current user can view or manage.

Calls:

GET /api/v1/users/self/bookmarks

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.bookmark.Bookmark

get_favorite_courses(**kwargs)

Retrieve the paginated list of favorite courses for the current user. If the user has not chosen any favorites, then a selection of currently enrolled courses will be returned.

Calls:

GET /api/v1/users/self/favorites/courses

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.course.Course

get_favorite_groups(**kwargs)

Retrieve the paginated list of favorite groups for the current user. If the user has not chosen any favorites, then a selection of groups that the user is a member of will be returned.

Calls:

GET /api/v1/users/self/favorites/groups

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.group.Group

get_groups(**kwargs)

Return the list of active groups for the user.

Calls:

GET /api/v1/users/self/groups

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.group.Group

reset_favorite_courses(**kwargs)

Reset the current user’s course favorites to the default automatically generated list of enrolled courses

Calls:

DELETE /api/v1/users/self/favorites/courses

Returns:

True if reset correctly, False otherwise.

Return type:

bool

reset_favorite_groups(**kwargs)

Reset the current user’s group favorites to the default automatically generated list of enrolled groups

Calls:

DELETE /api/v1/users/self/favorites/groups

Returns:

True if reset correctly, False otherwise.

Return type:

bool