Python script to download all of your student data from Canvas LMS

davekats, updated 🕥 2023-02-02 18:26:29

Introduction

The Canvas Student Data Export Tool can export nearly all of a student's data from Instructure Canvas Learning Management System (Canvas LMS). This is useful when you are graduating or leaving your college or university, and would like to have a backup of all the data you had in canvas.

The tool exports all of the following data: - Course Assignments - Course Announcements - Course Discussions - Course Pages - Course Files - Course Modules - SingleFile HTML of Assignments, Announcements, Discussions, Modules

The tool will export your data in JSON format, and will organize it nicely into folders named for every term of every year. Example: - Fall 2013 - Econ 101 - course files - modules - Econ 101.json - English 101 - course files - modules - English 101.json - Fall 2014 - Fall 2015 - Fall 2016 - Spring 2014 - Spring 2015 - Spring 2016 - Spring 2017 - Winter 2014 - Winter 2015 - Winter 2016 - Winter 2017 - all_output.json

Getting Started

Dependencies

To run the program, you will need the following dependencies:
pip install requests
pip install jsonpickle
pip install canvasapi
pip install python-dateutil
pip install PyYAML

npm i github:gildas-lormeau/SingleFile

You can install these dependencies using pip install -r requirements.txt AND npm i

Then run from the command line: python export.py

Configuration

These are the configuration parameters for the program: - Canvas API URL - this is the URL of your institution, for example https://example.instructure.com - Canvas API key - this can be created by going to Canvas and navigating to Account > Settings > Approved Integrations > New Access Token - Canvas User ID - this can be found at https://example.instructure.com/api/v1/users/self in the id field - Path to Cookies File - file needs to be in netscape format, you can get your cookies via a tool like "Get Cookies.txt" by Rahul Shaw. This can also be left blank if an html images are unwanted. - Directory in which to download course information to (will be created if not present) - List of Course IDs that should be skipped

If single file fails to find your browser, you can set a path in singlefile.py. If you also want to run additional singlefile arguments that can also be done there.

Loading credentials from a file

To avoid manually entering credentials every time you run the program, you can create a credentials.yaml file in the same directory as the script that has the following fields:

yaml API_URL: < URL of your institution > API_KEY: < API Key from Canvas > USER_ID: < User ID from Canvas > COOKIES_PATH: < Path to cookies file >

You can then run the script as normal: python export.py

Contribute

I would love to see this script's functionality expanded and improved! I welcome all pull requests :) Thank you!

Issues

Bump jszip from 3.7.1 to 3.10.1

opened on 2023-02-02 18:26:28 by dependabot[bot]

Bumps jszip from 3.7.1 to 3.10.1.

Changelog

Sourced from jszip's changelog.

v3.10.1 2022-08-02

  • Add sponsorship files.
    • If you appreciate the time spent maintaining JSZip then I would really appreciate your sponsorship.
  • Consolidate metadata types and expose OnUpdateCallback #851 and #852
  • use const instead var in example from README.markdown #828
  • Switch manual download link to HTTPS #839

Internals:

  • Replace jshint with eslint #842
  • Add performance tests #834

v3.10.0 2022-05-20

  • Change setimmediate dependency to more efficient one. Fixes Stuk/jszip#617 (see #829)
  • Update types of currentFile metadata to include null (see #826)

v3.9.1 2022-04-06

  • Fix recursive definition of InputFileFormat introduced in 3.9.0.

v3.9.0 2022-04-04

  • Update types JSZip#loadAsync to accept a promise for data, and remove arguments from new JSZip() (see #752)
  • Update types for compressionOptions to JSZipFileOptions and JSZipGeneratorOptions (see #722)
  • Add types for generateInternalStream (see #774)

v3.8.0 2022-03-30

  • Santize filenames when files are loaded with loadAsync, to avoid "zip slip" attacks. The original filename is available on each zip entry as unsafeOriginalName. See the documentation. Many thanks to McCaulay Hudson for reporting.
Commits


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/davekats/canvas-student-data-export/network/alerts).

Was not able to save the URL using singlefile. The reported error was No such file or directory

opened on 2022-12-12 19:34:19 by Bristopher

Describe the bug\ % python export.py Downloading course list page Was not able to save the URL https://xxxx.instructure.com/courses/ using singlefile. The reported error was No such file or directory Issue is only with single-file, the rest of the program will still run till completion with expected output/export.

To Reproduce\ Steps to reproduce the behavior:

  1. Manual installation: \ pip install -r requirements.txt\ sudo apt install git\ npm i github:gildas-lormeau/SingleFile

  2. Run: python export.py

  3. output snippet below ``` Welcome to the Canvas Student Data Export Tool

Connecting to canvas

Creating output directory: ./output

Getting list of all courses

Downloading course list page Was not able to save the URL https://xxxx.instructure.com/courses/ using singlefile. The reported error was No such file or directory Working on 2022 Fall C: CSE XXX: Algorithms (2022 Fall - C) Getting assignments ``` Expected behavior\ Save https://xxxx.instructure.com/courses/ to courses_list.html in ./ouput.

Environment - OS: Ubuntu 22.04.1 LTS\ - Browser: [email protected]\ - [email protected]\ - [email protected]\ - Node.js: v18.12.1\ - npm: 8.5.1

Bump minimatch from 3.0.4 to 3.1.2

opened on 2022-11-12 17:51:08 by dependabot[bot]

Bumps minimatch from 3.0.4 to 3.1.2.

Commits


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/davekats/canvas-student-data-export/network/alerts).

Issue with packages (I think)

opened on 2022-05-24 00:55:15 by nickyg543

Error after running export.py:

Getting list of all courses

Downloading course list page node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module 'C:\Users\Nick\ALLCOURSES\node_modules\single-file\cli\single-file' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Having a hard time interpreting this. I have all the packages installed.