Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Canvas langchain document loader

Features:

Indexes Canvas Modules, Pages, Announcements, Assignments and Files

The following file types are supported: md htm html docx xls xlsx pptx pdf rtf txt

(doc support would require libreoffice, so has not been implemented in this library)

Running locally (development)

You can build/run the provided Dockerfile, or install dependencies as described below

Docker

Edit canvas-test.py, fill in the correct api_url, api_key, and course_id.

Run (this also builds docker):

docker run -it $(docker build -q .)

Install Dependencies

pip install -r requirements.txt

Usage example:

from canvas_langchain.canvas import CanvasLoader

loader = CanvasLoader(
	api_url = "https://CANVAS_API_URL_GOES_HERE",
	course_id = CANVAS_ID_GOES_HERE,
	api_key = "API_KEY_GOES_HERE"
)

try:
	documents = loader.load()

	print("\nDocuments:\n")
	print(documents)

	print("\nInvalid files:\n")
	print(loader.invalid_files)
	print("")

	print("\nErrors:\n")
	print(loader.errors)
	print("")

	print("\nIndexed:\n")
	print(loader.indexed_items)
	print("")

	print("\nProgress:\n")
	print(loader.get_details('DEBUG'))
	print("")
except Exception:
	details = loader.get_details('DEBUG')

If errors are present, loader.errors will contain one list element per error. It will consist of an error message (key named message) and if the error pertains to a specific item within canvas, it will list the entity_type and the entity_id of the resource where the exception occurred.

Metadata

Release files for canvas-langchain 0.9.20

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for canvas-langchain 0.9.20
File Size Uploaded
canvas_langchain-0.9.20.tar.gz 22.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for canvas-langchain 0.9.20
File Interpreter ABI Platform
canvas_langchain-0.9.20-py3-none-any.whl Python 3 none any Details

Total release size: 48.5 kB

Release files / canvas_langchain-0.9.20.tar.gz

Download URL canvas_langchain-0.9.20.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
254943260c55aae04577d2d11ef8e695a1030d70126a90230fb77a9f605662f6
BLAKE2b-256 checksum
How to use checksums
d915554a0a541efc93e30bf3b52c02be608ee7a34c8ad41e01432a6d22e109df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.11

Release files / canvas_langchain-0.9.20-py3-none-any.whl

Download URL canvas_langchain-0.9.20-py3-none-any.whl
Size 26.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f326e85f92f442df99251567b0d11f049d2728f23ba7cc24fcb3e7bb89f2ac51
BLAKE2b-256 checksum
How to use checksums
0a3a20cbe9cbd5142b2bfef2600d81472b197fa8878f6ff07bfe0afdc9744860
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.11
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page