A small Python tool to collect individual student question level response data from Canvas SpeedGrader and export it to a flattened CSV.
In the Canvas UI, SpeedGrader shows per student question responses, but loading each student can take several seconds. This makes manual review or data extraction slow at scale. This tool automates that process using Playwright and captures the same network responses the browser receives.
- Logs into
Canvasusing a real browser session - Opens
SpeedGraderfor a specific course and assignment - Clicks through each student in
SpeedGrader - Captures
Learnosityquestion response data from network requests - Enriches each response with
student IDandname - Saves all student data into a single
JSONfile - Converts that
JSONinto a flattenedCSVwhere each question is one row - The result is a
CSVsuitable for analysis inExcel,Google Sheets, or a data tool.
The project is split into three scripts, each with a clear role.
login.py
- Handles
Canvasauthentication. - Opens a
Chromiumbrowser usingPlaywright - Allows you to complete
Canvaslogin and MFA manually - Saves the authenticated session to
storage_state.json - Reuses the saved session on future runs until it expires
- You only need to log in again if the session becomes invalid.
speedgrader_capture.py
- Automates
SpeedGraderand captures student responses. - Opens
SpeedGraderfor a given course and assignment - Waits for
speed_grader.jsonto load to build astudent IDto name map - Iterates through students using the
Next Studentbutton - Detects and skips students with no submission
- Listens for
Learnosityquestionresponses network calls - Attaches
student IDandnameto each response - Writes all collected data to
data/studentBreakdown.json - The script stops once it detects it has looped back to the first student.
speedgrader_data_clean.py
- Converts raw
JSONinto aCSV. - Reads
studentBreakdown.json - Cleans
HTMLfrom question text - Dynamically determines the maximum number of answer options
- Outputs one row per student per question
Includes:
- Student name
- Question text
- All answer options
- Correct solution(s)
- Student response(s)
- The output is written to
data/studentBreakdownParsed.csv.
Python3.9 or laterPlaywrightChromiumbrowser (installed viaPlaywright)
- Create and activate a virtual environment (recommended)
python -m venv .venv
source .venv/bin/activate # macOS / Linux
# .venv\Scripts\activate # Windows- Install dependencies
pip install -r requirements.txt
playwright installEdit the following values in speedgrader_capture.py:
COURSE_ID = 100
ASSIGNMENT_ID = 123
CANVAS_DOMAIN = "https://yourinstitution.instructure.com"Replace these with the correct values for your Canvas instance.
- Run the login script and complete
Canvaslogin:
python login.py- Capture all student responses from
SpeedGrader:
python speedgrader_capture.py- Convert the captured
JSONtoCSV:
python speedgrader_data_clean.pyAfter completion, your data will be available in the data folder.
Raw captured Learnosity responses enriched with student metadata.
Flattened CSV with one row per question per student.
Playwrightis pinned to a specific version to avoid breaking changes.- This relies on
Canvas UIbehaviour and network responses. Changes toCanvasorLearnosityendpoints may break it. - The browser runs in non headless mode so you can see progress and troubleshoot.
- This is not an official
Canvas APIintegration. - Use responsibly and in line with your institution’s data and privacy policies.
This tool is intended for analysis, QA, or internal review workflows where SpeedGrader UI access is too slow for large cohorts. It mirrors what a human user can see in the browser, but automates the repetitive parts.