CanvasRobot
Library which uses Canvasapi (minimally patched to allow more flexible user search) to provide a CanvasRobot class for GUI and commandline use. You can install the commandline tools canvasrobot and urltransform (special edition to translate specific video urls in Canvas pages) using UV
Setup
Before installing the tools, you may need to download a package manager to install dependencies—pieces of code that the application relies on. On macOS, we will use Homebrew and UV; on Windows, we will only use UV. Then, we will install the CanvasRobot tools.
To run the following prompts, one must copy and paste the commands in the command line and press the {enter} key after each line. During the setup, it might be necessary to restart the terminal after installing homebrew, uv, or transcribetools to be able to proceed.
Install UV
On Windows
-
Open Windows PowerShell or the Command shell. How?
-
Run prompt to install uv:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
On macOS:
-
Open Terminal
-
Run prompt to install brew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Run prompt to install uv:
brew install uv
Install the tools
- Install the (commandline) tools in this project.
uv tool install canvasrobot
canvasrobot --help
urltransform --help
Uses
- CanvasAPI
- rich (commandline output)
- rich_click (commandline input)
- keyring (safe store for the Canvas API key)
- pydal (to create a local SQLite database)
- pywebview (HTML reporting)
- [opt] pymemcache (install with
uv add pymemcacheto add caching the Canvas interaction, needsmemcachedinstalled)
Used
In word2quiz library.
(Not yet ready for general use...)
Examples using the CanvasRobot class
import rich
import canvasrobot as cr
if __name__ == '__main__':
console = rich.console.Console(width=160, force_terminal=True)
robot = cr.CanvasRobot(reset_api_keys=False,
console=console)
# robot.update_database_from_canvas()
robot.create_folder_in_all_courses('Tentamens')
# result = robot.enroll_in_course("", 4472, 'u752058',
# 'StudentEnrollment') # (enrollment={'type': 'StudentEnrollment'}
# user = robot.search_user('u752058')
# print(user)
# if not user:
# print(robot.errors)
#COURSE_ID = 9999 # test course
#result = robot.create_folder_in_course_files(COURSE_ID, 'Tentamens')
# print(robot.course_metada(COURSE_ID))
# print(robot.unpublish_folderitems_in_course(COURSE_ID,
# foldername,
# files_too=True))
#course = robot.get_course(COURSE_ID)
# tab = robot.get_course_tab_by_label(COURSE_ID, "Files")
# print(tab.visibility)
# for course_id in (COURSE_ID, COURSE_ID2):
# result = robot.create_folder_in_course_files(course_id, 'Tentamens')
# result = robot.unpublish_subfolder_in_all_courses(foldername,
# files_too=True,
# check_only=True)
# if course_ids_missing_folder:
# logging.info(f"Courses with missing folder {foldername}: {course_ids_missing_folder}")
# QUIZZES -----------------------------
# filename = 'Q_A.docx'
# robot.create_quizzes_from_document(filename=filename,
# course_id=COURSE_ID,
# question_format='Vraag {}. Vertaal:',
# adjust_fontsize=True,
# testrun=False
# )
[]
Metadata
Release files for canvasrobot 0.9.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| canvasrobot-0.9.3.tar.gz | 3.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| canvasrobot-0.9.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.1 MB
Release files / canvasrobot-0.9.3.tar.gz
| Download URL | canvasrobot-0.9.3.tar.gz |
|---|---|
| Size | 3.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b00346d2590240dc2f28bac5a240e8e23e6d66c98f2770e25d2a98755874bf5e
|
|
BLAKE2b-256 checksum How to use checksums |
78fa9338f4dffee6d867145bc642deee518c66dd74108bdf331af5a4f98f49c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / canvasrobot-0.9.3-py3-none-any.whl
| Download URL | canvasrobot-0.9.3-py3-none-any.whl |
|---|---|
| Size | 3.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5fb2b53c1438a706ea2e6986fe34df64ff6470125d37bdb129b84e3d2d64d408
|
|
BLAKE2b-256 checksum How to use checksums |
76a4ab4046fbb9f7441b7eb13ba990399407d93a415f2072446076f5359e2d07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|