Canvas LMS API Wrapper
raw JSON → 3.6.0 verified Fri May 01 auth: no python
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 Common errors
error ModuleNotFoundError: No module named 'canvasapi' ↓
cause canvasapi not installed
fix
pip install canvasapi
error canvasapi.exceptions.Unauthorized: 401 Unauthorized ↓
cause Invalid or missing API key
fix
Ensure you pass a valid API key to the Canvas constructor.
error AttributeError: 'PaginatedList' object has no attribute '...' ↓
cause 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())'
error TypeError: 'Canvas' object is not callable ↓
cause Forgetting to import and using wrong reference
fix
Use 'canvas = Canvas(url, key)' after 'from canvasapi import Canvas'
Warnings
gotcha API 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.
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.
deprecated Python 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.
gotcha Branching 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.
Imports
- Canvas wrong
from canvasapi.canvas import Canvascorrectfrom canvasapi import Canvas - Course wrong
cannot import from canvasapi.course directly before Canvas objectcorrectfrom canvasapi import Course
Quickstart
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)