A simple Python application which notifies users when their grades are updated in the Genesis Parent Portal via SMS, either through Gmail's SMTP server or via Twilio's SMS API, or through the Spontit App (recommended).
There are a few steps that you need to take in order to get this program working locally. The settings.py file below has to be filled out correctly:
1) There are some mandatory fields that you need to fill out. If you don't fill these out, it will not work.
# credentials for parent access
PARENT_ACCESS_EMAIL = ""
PARENT_ACCESS_PASSWORD = ""
# either push, sms, or email
NOTIFICATION_METHOD = "push"
# in minutess
REFRESH_INTERVAL = 1
# school student id
STUDENT_ID = ""
2) Now, you have to decide which notification mode you prefer. We currently support Twilio SMS, Gmail, or Spontit (recommended)
2a) If you prefer to be notified via email, fill out the Gmail credentials fields. For the password, your normal google password will not work, and you have to create an app specific password, and enter that password into the GMAIL_ACCOUNT_PASSWORD
field:
# gmail credentials
GMAIL_ACCOUNT_EMAIL = # google account email
GMAIL_ACCOUNT_PASSWORD = # app password
# email you want to send notifications to
DESTINATION_EMAIL =
If you prefer Email notifications, fill the PHONE_NUMBER_EMAIL
field with the destination email. If you would still like SMS notifications through email, you can look up your cellular carrier's extension to apply to the end of your phone number so that you can send emails to that email and have the emails be sent to your phone via SMS. If not, you can just fill this field out with the normal email that you would like these notifications to go to.
2b) If you prefer to be notified via SMS, fill out the Twilio API keys fields along with the Twilio phone number fields:
# twilio api keys
TWILIO_ACCOUNT_SID =
TWILIO_AUTH_TOKEN =
# phone numbers for twilio
TWILIO_PHONE_NUMBER =
DESTINATION_PHONE_NUMBER =
The TWILIO_ACCOUNT_SID
and the TWILIO_AUTH_TOKEN
should be available in your Twilio dashboard. TWILIO_PHONE_NUMBER
should be the phone number that Twilio assigns to you, and DESTINATION_PHONE_NUMBER
should be your phone number.
2c) If you want to be notified from Spontit's notification service, fill out your Spontit credentials:
###
### ONLY FILL OUT IF USING SPONTIT FOR NOTIFICATIONS (RECOMMENDED)
###
SPONTIT_USERNAME = ""
SPONTIT_SECCRET_KEY = ""
Now we have to update the array of classes in settings.py:
classes = {
"CLASS ONE": "XPATH ONE",
"CLASS TWO": "XPATH TWO",
"CLASS THREE": "XPATH THREE",
"CLASS FOUR": "XPATH FOUR",
"CLASS FIVE": "XPATH FIVE",
"CLASS SIX": "XPATH SIX",
"CLASS SEVEN": "XPATH SEVEN"
}
Here, replace all of the CLASS XXX
strings with the name of the course. This is completely up to you, and you can customize it to your liking. You can also add as many classes as you would like to track, and the program will track all of them.
In the second column, replace all of the XPATH XXX
strings with the xpath of the grades in parent access. In order to do this, you need to inspect the element of your grades and right click on the element that shows your grade within the <div>
tags. In the menu that shows up, you should see an option to copy which expands on hover. When expanded, one option should be to copy XPATH. It is imperative that you copy the right XPATHs for all of your classes, because these are the values that the program tracks. See the image below for how to copy the XPATH:
classes = {
"English 10H": "/html/body/table[1]/tbody/tr[2]/td/table/tbody/tr[2]/td[3]/table/tbody/tr/td[1]/div",
"AP US History": "/html/body/table[1]/tbody/tr[2]/td/table/tbody/tr[3]/td[3]/table/tbody/tr/td[1]/div",
"Chem H": "/html/body/table[1]/tbody/tr[2]/td/table/tbody/tr[4]/td[3]/table/tbody/tr/td[1]/div",
"Pre-Calc H": "/html/body/table[1]/tbody/tr[2]/td/table/tbody/tr[6]/td[3]/table/tbody/tr/td[1]/div",
"Spanish V H": "/html/body/table[1]/tbody/tr[2]/td/table/tbody/tr[7]/td[3]/table/tbody/tr/td[1]/div",
"AP CS A": "/html/body/table[1]/tbody/tr[2]/td/table/tbody/tr[8]/td[3]/table/tbody/tr/td[1]/div",
"Physical Education": "/html/body/table[1]/tbody/tr[2]/td/table/tbody/tr[10]/td[3]/table/tbody/tr/td[1]/div"
}
Lastly, we need to install python and all necessary dependencies. This should be quick! Run the following commands to get all dependencies installed:
pip3 install selenium
pip3 install schedule
pip3 install python-dotenv
pip3 install twilio
pip3 install spontit --upgrade && pip3 install requests