A python script that looks for available tickets to Mount Hermon and sends alerts in real-time to all emails interested.
Every fixed amount of seconds, using selenium, the script gets the HTML of the tickets page. The HTML is parsed using BeautifulSoup, and the script checks whether there are dates with available tickets. If so, the script sends an email to the email addresses specified, to notify about the tickets. Afterwards, the script sleeps for a fixed amount of time, and does the same process again.
All the settings are defined in the config.yaml
file and can be changed according to your needs.
Libraries used:
- Selenium
- Beautiful Soup
- PyYAML
pip install -r requirements.txt
The script works with selenium Firefox, so Firefox needs to be installed. In order to work with the selenium firefox-geckodriver, it needs to be installed:
Linux:
sudo apt install firefox-geckodriver
Windows:
The selenium firefox-geckodriver can be installed here.
After installing and extracting the geckodriver.exe, copy it into one of your System paths.
The script sends alerts to the emails specified in the beginning of the run. So before running the script, you need to fill in a working email address and a password for the email address you want the script to send the alerts from.
Change the following lines in the config.yaml
file: (lines 2-3)
# ===== Email settings =====
email_address: [email protected]
email_password: password_example
After the setup, you can run the python script. You can specify the time you want for the script to run and the email addresses you want to be notified in the command line arguments.
# Run the script for 10 minutes, and send alerts to: [email protected], [email protected]
python tickets.py --time=10 --recipients="[email protected], [email protected]"
# The same as above, but shorter
python tickets.py -t 10 -r "[email protected], [email protected]"
You can use the -v
or --verbose
option for a more verbose output, and -h
or --help
to see the help list.
In addition, you can edit the default values for all the command line options in the config.yaml
file.
This way you will be able to run the script without specifying any additional arguments.
That's it! Have fun skiing in the Hermon :)