CAPICO-Library
A helper library for Python 3 that provides a variety of helper functions for working with the Canvas API. Pagination is dealt with automatically for all relevant functions (so a returned pandas DataFrame will have ALL information).
To begin:
from CC_API_jh2 import CAPICO
Available Functions:
User-level Functions:
'''
Function gets page views for a user between start and end dates (UTC-8 DateTime objects).
Parameters:
user (String): Canvas user ID in question
token (String): Canvas token
start (DateTime): UTC-8 DateTime object for start of time range
end (DateTime): UTC-8 DateTime object for end of time range
Returns:
Pandas dataframe of all pages views for a user between start and end date
'''
def get_user_page_views(user, token, url, start, end)
Course-level Functions:
'''
Helper function that gets Canvas course information.
Parameters:
course_id (String): ID of Canvas course
token (String): User-generated API token
url (String): URL of Canvas instance
Returns:
Course object (JSON)
'''
def get_course_info(course_id, token, url)
'''
Gets all students in a course.
Parameters:
url (String): URL of Canvas instance
class_id (String): Canvas ID of course
token (String): Canvas token
Returns:
Pandas DataFrame of students in a course
'''
def get_student_list(url, class_id, token)
'''
Gets all course modules
Parameters:
url (String): URL of Canvas instance
class_id(String): Canvas ID of course
token (String): Canvas token
Returns:
Pandas DataFrame of modules in a course
'''
def get_course_modules(url, class_id, token)
'''
Gets all course pages
Parameters:
url (String): URL of Canvas instance
class_id(String): Canvas ID of course
token (String): Canvas token
Returns:
Pandas DataFrame of pages in a course
'''
def get_course_pages(url, class_id, token)
'''
Gets all course files
Parameters:
url (String): URL of Canvas instance
class_id(String): Canvas ID of course
token (String): Canvas token
Returns:
Pandas DataFrame of files in a course
'''
def get_course_files(url, class_id, token)
'''
Gets all users with as specified role in a course
Parameters:
url_in (String): URL of Canvas instance
token_in (String): Canvas token
course_in (String): Canvas ID of course
user_type (String): Specified role to look for (e.g. students)
Returns:
Pandas DataFrame of all users with a specified role in a course
'''
def get_course_users(url_in, token_in, course_in, user_type)
# allow_student_organized_groups, enable_offline_web_export
'''
Change settings for a course
Parameters:
url_in (String): URL of Canvas instance
token_in (String): Canvas token
course_in (String): Canvas ID of course
setting_name (String): Name of setting to change
setting_value (int/Boolean): 1 is True, 0 is False
Returns:
None
'''
def change_course_settings(url_in, token_in, course_in, setting_name, setting_value)
Course-quiz functions:
'''
Get all submissions for a specified quiz (Incomplete)
Parameters:
url_in (String): URL of Canvas instance
token_in (String): Canvas token
course_in (String): Canvas ID of course
quiz_in (String): Canvas ID of quiz
Returns:
JSON of all quiz submissions
'''
def get_all_quiz_submissions(url_in, token_in, course_in, quiz_in)
'''
Gives specified extra time to student
Parameters:
url (String): URL of Canvas instance
token (String): Canvas token
class_id (String): Canvas ID of course
quiz_id (String): Canvas ID of quiz
student_id (String): Canvas ID of student
extra_time (String): Extra time given to student in minutes
Returns:
Response body of API request
'''
def extend_time(url, token, class_id, quiz_id, student_id, extra_time)
'''
Gives specified extra time to all students in a course
Parameters:
url (String): URL of Canvas instance
token (String): Canvas token
class_id (String): Canvas ID of course
quiz_id (String): Canvas ID of quiz
extra_time (String): Extra time given to student in minutes
Returns:
None
'''
def extend_all(url, token, class_id, quiz_id, extra_time)
Blueprint-level functions:
'''
Helper function that gets a list of courses associated with a blueprint course (MAY CHANGE WHEN BLUEPRINT SYSTEM UPDATED)
Parameters:
blue_id: Blueprint course ID on Canvas
token: User-generated API token
url: URL of Canvas instance
'''
def get_associated_courses(blue_id, token, url)
'''
Function adds and removes courses from blueprint associations
Parameters:
blue_id (String): Canvas ID of blueprint course
token (String): Canvas token
url (String): Canvas URL
to_remove (List[String]): List of courses to remove from blueprint association (if you do not wish to remove any, give an empty list)
to_add (List[String]): List of courses to add from blueprint association (if you do not wish to add any, give an empty list)
Returns:
None
'''
def update_associations(blue_id, token, url, to_remove, to_add)
Subaccount-level functions:
'''
Function prints out the subaccount structure of a given node
Parameters:
account_id (String): Canvas ID of node to find children for
token (String): Canvas token
url (String): Canvas URL
Returns:
None
'''
def print_subaccount_tree(account_id, token, url)
'''
Gets the info about a subaccount (Incomplete)
'''
def get_account_info(url_in, token_in, subaccount_in)
'''
Gets all courses under a subaccount (and all of its children accounts as well)
Parameters:
url_in (String): URL of Canvas instance
token_in (String): Canvas token
subaccount_in (String, int): Canvas Subaccount ID
Returns:
Pandas DataFrame of all course under a subaccount
'''
def get_account_courses(url_in, token_in, subaccount_in)
# See change_course_settings
def change_course_settings_subaccount(url_in, token_in, subaccount_in, setting_names, setting_value)
'''
List all of the enrollment terms under a master account
Parameteres:
url_in (String): URL of Canvas instance
token_in (String): Canvas token
subaccount_in (String): Canvas ID of master account
Returns:
Pandas DataFrame of all enrollment terms
'''
def list_enrollment_terms(url_in, token_in, subaccount_in)
Release files for CC-API-jh2 0.11.511
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| CC_API_jh2-0.11.511-py3-none-any.whl | Python 3 | none | any | Details |
Release files / CC_API_jh2-0.11.511-py3-none-any.whl
| Download URL | CC_API_jh2-0.11.511-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2bb21888f360e06b04d9bd16727c514a98013a9b441d60405ed79012dceae01e
|
|
BLAKE2b-256 checksum How to use checksums |
32a30bf46750db848dfacc27f5b03ecab8e07415dc6b8efb787a715decc0dac6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
|