canvas-student-data-export/README.md

76 lines
2.3 KiB
Markdown
Raw Permalink Normal View History

2019-08-15 23:38:16 -06:00
# Introduction
2023-10-27 16:48:16 -06:00
Forked from https://github.com/davekats/canvas-student-data-export
2023-10-27 18:04:07 -06:00
Major changes:
- Reorganized the project structure.
- Refactored the code to make it more Pythonic.
- Added progress bars.
- Use threading where possible.
- Save assignment attachements.
2023-10-27 18:06:32 -06:00
- Save all user files.
2023-10-27 16:48:16 -06:00
---
The Canvas Student Data Export Tool can export nearly all of a student's data from Instructure Canvas Learning Management System (Canvas LMS).
2023-10-27 18:04:07 -06:00
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. Also, some instructors disable the built-in export tool.
2019-08-15 23:38:16 -06:00
2023-10-27 16:48:16 -06:00
The tool exports all of the following data for each course:
- Assignments
- Announcements
- Discussions
- Pages
- Files
- Modules
- Single file webpage of the Canvas page for grades, assignments, announcements, discussions, and modules
2023-10-27 16:48:16 -06:00
2023-10-27 18:06:32 -06:00
Additionally, all your files stored on Canvas (such as historic submissions and attachments) will be downloaded.
2023-10-27 16:48:16 -06:00
**TO DO LIST**
- [x] Export grades.
- [x] Detect when the cookies and API token are not valid.
- [ ] Use argparse.
- [ ] Add an argument to prohibit overwriting existing files.
- [ ] Have the path to the Chrome binary be specified by a required argument.
- [ ] Use logging.
- [ ] Refactor `download_canvas.py`.
- [ ] Refactor `export.py`.
2023-10-27 16:48:16 -06:00
## Install
```shell
pip install -r requirements.txt
npm install
```
2023-10-27 18:04:07 -06:00
Make sure you have Chomium or Chrome installed. Currently, the executable path is hardcoded to `/usr/bin/chromium-browser` in `module/singlefile.py`. If you are not on Linux or do not use Chromium, you will need to change the path.
2023-10-27 16:48:16 -06:00
## Run
1. Get your Canvas API key by going to Canvas and navigating to `Account` > `Settings` > `Approved Integrations` > `New Access Token`
2. Get your Canvas User ID at `https://example.instructure.com/api/v1/users/self` in the `id` field
3. Save your cookies for your Canvas domain
Then, create the file `credentials.yaml` with the following content:
```yaml
2023-10-27 16:48:16 -06:00
API_URL: [ base Canvas URL of your institution ]
API_KEY: [ API Key from Canvas ]
USER_ID: [ user ID from Canvas ]
COOKIES_PATH: [ path to cookies file ]
```
2023-10-27 16:48:16 -06:00
Make `credentials.yaml` is in the same directory as `export.py`.
2023-10-27 16:48:16 -06:00
<br>
Now, run the program:
```shell
python export.py
```
2023-10-27 18:04:07 -06:00
The folder `./output` will be created and your data downloaded to this path.