Registry / communication / canvasapi

canvasapi

JSON →
library3.6.0pypypi✓ verified 88d ago

A Python wrapper for the Canvas LMS API. Provides object-oriented access to Canvas resources like courses, users, assignments, and more. Current version 3.6.0, released 2026-03-12. Regular releases approximately every 6 months.

pip install canvasapi
INSTALL
IMPORT
SIG · CANVASAPI
C
canvasapi
communicationpythonv3.6.0
Install
2.7s avg
Import
730ms
Disk
28MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v3.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.778s · 29.5MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.7s · import 0.682s · 30MB
28MB installed
● package 28MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Canvas
✓ from canvasapi import Canvas
✗ from canvasapi.canvas import Canvas
Canvas is a top-level export
Course
✓ from canvasapi import Course
✗ cannot import from canvasapi.course directly before Canvas object
Course uses are returned from Canvas methods; direct import not common

Initialize a Canvas object with your instance URL and API key, then fetch current user and courses.

from canvasapi import Canvas # Replace with your Canvas instance URL and API key api_url = 'https://canvas.instructure.com' api_key = os.environ.get('CANVAS_API_KEY', '') canvas = Canvas(api_url, api_key) user = canvas.get_current_user() print(f"Hello, {user.name}!") # List courses courses = canvas.get_courses() for course in courses: print(course.name)
Debug
Known issues
gotchaAPI rate limits can cause 'RateLimitExceeded' exceptions (3.5.0+). Previously these were raised as 'Forbidden' (HTTP 403). If you catch rate limits, check your exception handling.
fix
Catch 'canvasapi.exceptions.RateLimitExceeded' instead of relying on HTTP 403.
affects: >=3.5.0
breaking'set_quiz_score' and related quiz score methods were removed in v3.0.0. Use quiz submission endpoints instead.
fix
Use 'QuizSubmission.update_score_and_comments()' or similar.
affects: >=3.0.0
deprecatedPython 3.7 and 3.8 support dropped in v3.4.0. Use Python 3.9+.
fix
Upgrade to Python 3.9, 3.10, 3.11, 3.12, or 3.13.
affects: >=3.4.0
gotchaBranching from PaginatedList into two separate lists can exhaust the iterator. Always convert to list if you need to reuse the iteration.
fix
Use 'list(canvas.get_courses())' to materialize the list.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'canvasapi'
canvasapi not installed
fix
pip install canvasapi
canvasapi.exceptions.Unauthorized: 401 Unauthorized
Invalid or missing API key
fix
Ensure you pass a valid API key to the Canvas constructor.
AttributeError: 'PaginatedList' object has no attribute '...'
Trying to access a method directly on PaginatedList instead of iterating
fix
Iterate over the PaginatedList or convert to list first: 'list(canvas.get_courses())'
TypeError: 'Canvas' object is not callable
Forgetting to import and using wrong reference
fix
Use 'canvas = Canvas(url, key)' after 'from canvasapi import Canvas'
Upgrade
Version history
3.6.0latest on PyPI · released Apr 16, 2026
Audit
Dependencies
requestsrequiredHTTP client used for API calls
pytzrequiredTimezone handling for datetime objects
Agent activity
44 hits · last 30 days
node
36
OpenAI (training)
1
Resources
canvasapi — pip install canvasapi · libregistry