Never miss turning in an assignment on Canvas again. Get notified by email when a due date is approaching.
-
Clone repository
-
cd
into the project's directory, and create a virtural environmentpython3 -m venv env source env/bin/activate
-
Install dependencies
pip3 install -r requirements.txt
-
Create a
.env
fileexport CANVAS_API_USER_TOKEN="" export SEND_FROM_EMAIL="" export SEND_FROM_PASS="" export SEND_TO_EMAIL=""
-
Generate an access token through Canvas.
You are able to generate a token in Canvas under your settings:
{canvas-domain}/profile/settings
In
.env
, setCANVAS_API_USER_TOKEN
to your token. -
In
config.py
, add relevant course ids toCOURSES_IDS
To find the course ids of your courses, make a request:
curl -H 'Authorization: Bearer <token>' https://<canvas>/api/v1/courses?per_page=999
The course id key is
id
-
If you are not sending with gmail, modify
SMTP_SERVER_NAME
andSMTP_PORT
inconfig.py
with the respective name and port. -
In
.env
, setSEND_FROM_EMAIL
andSEND_FROM_PASS
to the credentials of the emails of which you are sending from.If using Gmail, allow less secure apps. For security, it is recommended you use do not do this on your primary email.
-
In
.env
, setSEND_TO_EMAIL
to the email to which you want to receive emails from. -
Optional: In
config.py
, modifyNOTIFY_DAY
to the amount of days between a due date and current date. -
Optional: To disable logging, set
LOG_ERRORS
inconfig.py
to False. But, error logging may be useful should something break or change. An example of a log:2022-03-01 03:46:51.495281: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials y28-20020a4aea3c000000b0031c0cddfbf9sm5766114ood.20 - gsmtp')
You can run this script many ways.
- Manually. It defeats the purpose of automation, but
python3 run.py
is foolproof I suppose. - Schedule a cron job, if you have a Linux or Unix machine. Modifications to the script may be necessary.
- Or, use a cloud service. PythonAnywhere allows you to schedule daily tasks for free