User¶
-
class
canvasapi.user.
User
(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_observee
(observee_id)¶ Registers a user as being observed by the given user.
Calls: PUT /api/v1/users/:user_id/observees/:observee_id Parameters: observee_id (int) – The login id for the user to observe. Return type: class: canvasapi.user.User
-
add_observee_with_credentials
(**kwargs)¶ Register the given user to observe another user, given the observee’s credentials.
Calls: POST /api/v1/users/:user_id/observees Return type: canvasapi.user.User
-
create_folder
(name, **kwargs)¶ Creates a folder in this user.
Calls: POST /api/v1/users/:user_id/folders Parameters: name (str) – The name of the folder. Return type: canvasapi.folder.Folder
-
edit
(**kwargs)¶ Modify this user’s information.
Calls: PUT /api/v1/users/:id Return type: canvasapi.user.User
-
get_assignments
(course, **kwargs)¶ Return the list of assignments for this user if the current user (the API key owner) has rights to view. See List assignments for valid arguments.
Calls: GET /api/v1/users/:user_id/courses/:course_id/assignments Parameters: course ( canvasapi.course.Course
or int) – The object or ID of the course to retrieve.Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.assignment.Assignment
-
get_avatars
()¶ Retrieve the possible user avatar options that can be set with the user update endpoint.
Calls: GET /api/v1/users/:user_id/avatars Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.avatar.Avatar
-
get_color
(asset_string)¶ Return the custom colors that have been saved by this user for a given context.
The asset_string parameter should be in the format ‘context_id’, for example ‘course_42’.
Calls: GET /api/v1/users/:id/colors/:asset_string Parameters: asset_string (str) – The asset to retrieve the color from. Return type: dict
-
get_colors
()¶ Return all custom colors that have been saved by this user.
Calls: GET /api/v1/users/:id/colors Return type: dict
-
get_courses
(**kwargs)¶ Retrieve all courses this user is enrolled in.
Calls: GET /api/v1/users/:user_id/courses Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.course.Course
-
get_enrollments
(**kwargs)¶ List all of the enrollments for this user.
Calls: GET /api/v1/users/:user_id/enrollments Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.enrollment.Enrollment
-
get_file
(file, **kwargs)¶ Return the standard attachment json object for a file.
Calls: GET /api/v1/users/: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 user’s folder
Calls: GET /api/v1/users/:user_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_missing_submissions
()¶ Retrieve all past-due assignments for which the student does not have a submission.
Calls: GET /api/v1/users/:user_id/missing_submissions Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.assignment.Assignment
-
get_page_views
(**kwargs)¶ Retrieve this user’s page views.
Calls: GET /api/v1/users/:user_id/page_views Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.course.PageView
-
get_profile
(**kwargs)¶ Retrieve this user’s profile.
Calls: GET /api/v1/user/:id Return type: dict
-
list_calendar_events_for_user
(**kwargs)¶ List calendar events that the current user can view or manage.
Calls: GET /api/v1/users/:user_id/calendar_events Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.calendar_event.CalendarEvent
-
list_communication_channels
(**kwargs)¶ List communication channels for the specified user, sorted by position.
Calls: GET /api/v1/users/:user_id/communication_channels Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.communication_channel.CommunicationChannel
-
list_files
(**kwargs)¶ Returns the paginated list of files for the user.
Calls: GET api/v1/courses/:user_id/files Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.file.File
-
list_folders
()¶ Returns the paginated list of all folders for the given user. This will be returned as a flat list containing all subfolders as well.
Calls: GET /api/v1/users/:user_id/folders Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.folder.Folder
-
list_observees
(**kwargs)¶ List the users that the given user is observing
Calls: GET /api/v1/users/:user_id/observees Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.user.User
-
list_user_logins
(**kwargs)¶ Given a user ID, return that user’s logins for the given account.
Calls: GET /api/v1/users/:user_id/logins Return type: canvasapi.paginated_list.PaginatedList
ofcanvasapi.login.Login
-
merge_into
(destination_user)¶ Merge this user into another user.
Calls: PUT /api/v1/users/:id/merge_into/:destination_user_id Parameters: destination_user ( canvasapi.user.User
or int) – The object or ID of the user to merge into.Return type: canvasapi.user.User
-
remove_observee
(observee_id)¶ Unregisters a user as being observed by the given user.
Calls: DELETE /api/v1/users/:user_id/observees/:observee_id Parameters: observee_id (int) – The login id for the user to observe. Return type: class: canvasapi.user.User
-
show_observee
(observee_id)¶ Gets information about an observed user.
Calls: GET /api/v1/users/:user_id/observees/:observee_id Parameters: observee_id (int) – The login id for the user to observe. Return type: class: canvasapi.user.User
-
update_color
(asset_string, hexcode)¶ Update a custom color for this user for a given context.
This allows colors for the calendar and elsewhere to be customized on a user basis.
The asset_string parameter should be in the format ‘context_id’, for example ‘course_42’. The hexcode parameter need not include the ‘#’.
Calls: Parameters: - asset_string (str) – The asset to modify the color for.
- hexcode (str) – The hexcode of the color to use.
Return type: dict
-
update_settings
(**kwargs)¶ Update this user’s settings.
Calls: PUT /api/v1/users/:id/settings Return type: dict
-
upload
(file, **kwargs)¶ Upload a file for a user.
NOTE: You must have authenticated with this user’s API key to upload on their behalf no matter what permissions the issuer of the request has.
Calls: POST /api/v1/users/:user_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 (