A suite of tools and Python interface for Instructure's Canvas LMS.
Project description
Py Canvas
A suite of tools and Python interface for Instructure's Canvas LMS.
This project is not affiliated with Instructure.
Documentation Table of Contents:
Installation
The project (tools and API) can be installed from PyPi with:
pip install py-canvas
Standard Python requirements are listed in pyproject.toml
.
The project and Python dependencies can be installed from source with:
pip3 install .
CLI Configuration
Before discussing specific tools, you should know some general information about configuring and sending options to each CLI tool.
To know who you are and what you are working on the package needs a few configuration options:
server
-- The Canvas server to connect to.course
-- The Canvas ID for the course you are working with.token
-- Your Canvas API token (see the Canvas documentation.assignment
-- The Canvas ID for the current assignment you are working on (does not always apply).
All these options can be set on the command line when invoking on of these tools, e.g.,:
python3 -m canvas.cli.user.list --server canvas.test.com --course 12345 --token abc123
However, it will generally be more convenient to hold these common options in a more reusable location.
There are several other places that config options can be specified, with each later location overriding any earlier options. Here are the places options can be specified in the order that they are checked:
./config.json
-- If aconfig.json
exists in the current directory, it is loaded.<platform-specific user config location>/py-canvas.json
-- A directory which is considered the "proper" place to store user-related config for the platform you are using (according to platformdirs). Use--help
to see the exact place in your specific case. This is a great place to store login credentials.- Files specified by
--config
-- These files are loaded in the order they appear on the command-line. - Bare Options -- Options specified directly like
--course
or--token
. These will override all previous options.
Using the default config file (config.json
):
# `./config.json` will be looked for and loaded if it exists.
python3 -m canvas.cli.user.list
Using a custom config file (my_config.json
):
# `./my_config.json` will be used.
python3 -m canvas.cli.user.list --config my_config.json
For brevity, all future commands in this document will assume that all standard config options are in the default config files (and thus will not need to be specified).
CLI Tools
All CLI tools can be invoked with -h
/ --help
to see the full usage and all options.
List Course Users
Course users can be listed using the canvas.cli.user.list
tool.
For example:
python3 -m canvas.cli.user.list
To list each user as a tab-separated row, use the -t
/ --table
option:
python3 -m canvas.cli.user.list --table
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
Built Distribution
Hashes for edq_canvas-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bb12ace464cfa5549dcdae5052a11a2846e2b190b511eb8adbfda59a7b93d09 |
|
MD5 | 5d44bd17d7b901b17e96f5334b95fec0 |
|
BLAKE2b-256 | 9143adc34276f1ca91af9b7b05cf6d635f7ddf628a150bdcb1dad6b214be2963 |