This application extracts syllabi from Canvas, downloads them, and adds it to an index.html file
- Install Python 3.7 or greater.
- Install Git.
- First, clone this repo.
git clone https://github.com/UBC-LFS/lfs-canvas-syllabus-python.git
pip install virtualenv
virtualenv venv
On Windows
venv\Scripts\activate
On Linux
source venv\bin\activate
pip install -r requirements.txt
Create a .env
file.
This is where you'll specify the URL and token as show below. Don't add quotes. You can swap out the domain if you want to run it off production.
CANVAS_API_TOKEN=PLACE YOUR TOKEN HERE
CANVAS_API_DOMAIN=https://ubc.beta.instructure.com
- Run
getSyllabi.py
:
python getSyllabi.py
- Input the year you are interested in (if you are interested in more than one year, you'll need to run the script more than one time).
- Select the terms you are interested in. You can select multiple terms by pressing space. If you want to select all the terms, leave the default selection of 'All'.
- Input the account number of your Faculty. For LFS, it's 15.
- Wait for the script to gather the syllabuses. Depending on how many terms you select and how many courses there are, this could take some time.
- The syllabuses are now downloaded in
output/syllabi
, inside folders that indicate what year/term the course was offered. - The name of the courses without a syllabus will be added
output/coursesWithNoSyllabus/{session}
- Do not worry what
lastUpdatedSessionKey
is. This is just so the script can determine if the file was created in the past, or when it just ran.
- Do not worry what
- Note: If you encounter "
Error: list index out of range
", it most likely means that the syllabus does not exist on Canva or it's due to some permission errors.