
Canvas Connector
A Python package for easily connecting to the Canvas LMS API.
Features
- Easy authentication with Canvas API
- Fetch courses, assignments, and grades
- Get peer information
- Track upcoming assignments
- Discussion board interactions
- Submit assignments and post comments
- Built with Polars for fast data processing
Installation
Using uv (recommended)
Using pip
For development (contributing)
Setup
1. Get Your Canvas API Token
- Log into Canvas
- Go to Account → Settings
- Scroll to "Approved Integrations"
- Click "+ New Access Token"
- Copy the token (you won't see it again!)
2. Create a .env file
CANVAS_API_TOKEN=your_canvas_api_token_here
CANVAS_URL=https://byui.instructure.com
TIMEZONE=America/Denver
Important: Add .env to your .gitignore to keep your token private!
Quick Start
from canvasconnector import CanvasClient, get_courses_polars
from dotenv import load_dotenv
import os
load_dotenv()
client = CanvasClient(
api_key=os.getenv("CANVAS_API_TOKEN"),
canvas_url=os.getenv("CANVAS_URL"),
timezone=os.getenv("TIMEZONE")
)
courses = get_courses_polars(client, current_only=True)
print(courses)
Documentation
For detailed usage examples, see the Code Examples guide.