A small async API wrapper for Canvas Parents.
Project description
Canvas Parent API
This is an async wrapper for the Canvas API from Instructure. There are a few types of objects this will retrieve based on the assumption that you are a parent with students enrolled with Canvas.
The types of objects that can be returned include:
- Observees (Students)
- Courses
- Assignments
This module is provided for use with the Home Assistant custom integration Canvas however it could be useful as a standalone module for your own projects as well.
Installing
To install the module use:
python3 -m pip install canvas-parent-api
Get API Token
If you are a parent, you will have a Canvas Parent account. To get an API token, you must sign into the Canvas Parent application from a web browser. This is typically using: https://.instructure.com/login/canvas
Once you have signed into your account, navigate to Account > Settings.
Under "Approved Integrations" click "+ New Access Token" to create a new API Token.
Enter a Purpose and Expiration date (blank for no expiration).
Be sure to save your API token, as you will have to generate a new token if this is lost.
Usage
Example usage to get students, printing names:
import asyncio
from canvas_parent_api import Canvas
base_url = "https://school.instructure.com"
api_token = "randomstringthatisntreallyatoken"
async def get_students():
client = Canvas(f"{base_url}",f"{api_token}")
return await client.observees()
students = asyncio.run(get_students())
for student in students:
print(student.name)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for canvas_parent_api-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01663e9d753ff3b0e16c0d6624ff0b7213ee3908d519b2bcef1d25d1571e05ee |
|
MD5 | b4890be71c47f24879a55019ebd82642 |
|
BLAKE2b-256 | 6600e0d5306b54581037f3257668e62360246f46614a29cf5bdbf4f0e499dfa4 |