Skip to content

jeremywgleeson/purdue-flight-schedule-monitor

Repository files navigation

Purdue Flight Schedule Monitor

Purdue Flight Schedule Monitor is a python monitoring script that checks the Purdue airport flight schedule website for reservation cancellations, and emails you about them.

Usage

The script can be run by itself, or you can use the provided docker image to deploy the script as a service on your favourite cloud. (See Deployment)

To run independently:

  1. Clone repository
  2. Optionally create an environment
  3. pip install -r requirements.txt
  4. python main.py

Running the script to check for changes has no advantage to just checking the website yourself (unless run at regular intervals). To learn why, read About the code

To build and run a custom docker image, make modifications then:

# build image
docker build -t flight-monitor .
# run with environmental variables
docker run --env EMAIL_CONTACT --env EMAIL_HOST --env EMAIL_PORT --env EMAIL_LOGIN --env EMAIL_PASSWORD --env TARGET_EMAIL -d flight-monitor

Deployment

To deploy the docker image, use the image on your favourite cloud:
Image on Dockerhub
This image requires secrets passed as environmental variables in order to work correctly.

If you prefer to build a custom image with secrets and config baked in, please do so.

Environment variables

Required configs/secrets:

# EMAIL_CONTACT Is the service owner's email
EMAIL_CONTACT
# EMAIL_HOST Is the service sender email SMTP host (ex: smtp.gmail.com)
EMAIL_HOST
# EMAIL_HOST Is the service sender email STMP port (ex: 465)
EMAIL_PORT
# EMAIL_LOGIN Is the service sender email STMP login (ex: [email protected])
EMAIL_LOGIN
# EMAIL_PASSWORD Is the service sender email STMP password (ex: ********)
EMAIL_PASSWORD
# EMAIL_PASSWORD Is the receiving email the service should send notifications to (ex: [email protected])
TARGET_EMAIL

Configuration

You can overwrite any of the configuration variables by changing the config.yaml and re-building the image. To overwrite simple variables, you may declare any config variables as environmental variables and set them in the Dockerfile, then re-build the image.
To learn more about configuration options, see config.yaml

About the code

On the first run, the python application will scrape all reservations in the given time window and store them in an SQLAlchemy database that includes ORM for Schedule and Reservation classes.
Every subsequent run, the python application will scrape all reservations in the given time window and check for differences against the database. It will email deletions to the target email, then update the database to contain the current schedules.
Finally, the app removes all schedules and reservations from all previous days.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published