Concordia added 2-factor authentication, this means that the application can no longer log itself in to moodle and make requests on your behalf.
Make sure you have the following installed: git, python3+
To clone the repo run the following in your terminal.
git clone https://github.com/volovikariel/moodle-notifier.git
Then install all dependencies required to run the script by by running the following in your terminal.
python3 -m pip install -r requirements.txt
NOTE: On Windows, you may have to use py -3
instead of python3
Run the following in your terminal to generate a .env
file (which stores all your configuration).
python3 moodle_notifier.py
Inside the .env
file, do the following:
- Put in your portal username (the X_XXXXXX in
concordia.ca\X_XXXXXX
). - Put in your portal password.
- Put in your email (only works with GMAIL).
- Put in your email app password.
- Put in the email(s) you want to receive the notifications.
- Now put in the delay between fetches you'd like to have.
How to get an app password
- go to manage my google account
- Under "Signing in to Google" confirm that "2-Step Verification" is "On" for the account.
- Under "Signing in to Google" Select "App passwords".
- Select the app as "Mail" and the device as "Other (Custom name)" and name it (e.g: moodle_notifications).
- Copy the app password, it will be in a yellow box and looks like: "XXXX XXXX XXXX XXXX".
You can now try running the program by running
python3 moodle_notifier.py
You can run the following in your terminal before closing it to have the script run in the background.
nohup python3 moodle_notifier.py &
If you ever want to kill the process you can run the following in your terminal to first find the process id, and then kill that process.
ps -e | grep python3
kill -9 id_returned
note: If you have several programs running on python3
, then I'm not sure how further help you narrow it down. I use python3.10
and I never have other processes using it.
You can run the following in your terminal to run the script in the background
pythonw.exe moodle_notifier.py
To kill the process, you can open the task manager and kill the process called pythonw.exe
.
Create a systemd service by creating a file called moodle-notifier.service
under /etc/systemd/system/
.
Set its contents to the following (remember to modify the directories and paths):
[Unit]
Description=Moodle Notification startup service
Documentation=https://github.com/volovikariel/moodle-notifier
After=network-online.target
[Service]
User=your_user
WorkingDirectory=/path/to/directory/containing/the/script
ExecStart=/path/to/python (e.g: /usr/bin/python) /path/to/directory/containing/the/script/moodle_notifier.py
Restart=always
StandardOutput=file:/path/to/where/you/want/to/save/your/logs
StandardError=file:/path/to/where/you/want/to/save/your/logs
[Install]
WantedBy=multi-user.target
Then reload the daemon to recognize the new service:
systemctl daemon-reload
Then you can start the service:
systemctl start moodle-notifier.service