Skip to main content

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
  • Submissions

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)

Patch Notes

  • 0.0.12:

    • Added pagination support to automatically paginate to end of available requests
  • 0.0.9:

    • Added Submissions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

canvas_parent_api-0.0.12.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

canvas_parent_api-0.0.12-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file canvas_parent_api-0.0.12.tar.gz.

File metadata

  • Download URL: canvas_parent_api-0.0.12.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.2

File hashes

Hashes for canvas_parent_api-0.0.12.tar.gz
Algorithm Hash digest
SHA256 102f6b5ca41a67c464120e01846e49f947762602e3f517b244e7c9fe6f54b7b9
MD5 48fd990b6c8cac226cf30950b4275076
BLAKE2b-256 7483a16170411c7ec8621bbb4ad3077c97bbbe8fea6679645f76b23a6b618945

See more details on using hashes here.

File details

Details for the file canvas_parent_api-0.0.12-py3-none-any.whl.

File metadata

File hashes

Hashes for canvas_parent_api-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 cd55c6563719c0e08d33744b1316b9b70914cd222decd0e2c01de1905595ce95
MD5 2de5c58ea67438f5d6c69af7e29969b9
BLAKE2b-256 d9131f5697043436d2481df22b370df6fdf131759d48ab9c89d4975f44a45d6e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page