Automated Stubhub ticket price checking with python & selenium
This project was created to programatically check ticket prices on stubhub for the Big East championship game. It uses selenium webdriver to navigate to the ticketing page and locate and read xml elements. If the ticket price is below a specified threshold, an automated email is then sent to notify the user. You can adapt this ticket bot for your own use by modifying the ticket url, element xpaths, email content, and price threshold.
ticket_bot.py
➡️ this file is home to the main bot functionality - the webdriver navigation, the price checking, and the final email notification processsend_email.py
➡️ generic function for sending an email with stmplibsend_sms.py
➡️ generic function for sending an sms message with twilio
- See
requirements.txt
for dependencies
- Clone the repo
git clone https://github.com/kgarrity22/ticket-price-alert
- Install dependencies
pip install -r requirements.txt
- In
ticket_bot.py
replace the constant values with your own desired ticket info (STUBHUB_URL
,TICKET_X_PATHS
,EMAIL_SUB
,PRICE_THRESHOLD
) - Create your own
keys.py
file with the following (if you wish to send & receive email notifications):
SENDER_EMAIL
SENDER_PASSWORD
RECEIVER_EMAIL
- for SENDER_PASSWORD with gmail, you'll need to create an app password If you have an active Twilio account you can also define the following in order to receive notifications via text:
TWILIO_ACCOUNT_ID
TWILIO_AUTH_TOKEN
TWILIO_NUMBER
CELL_NUMBER
If you want to schedule the program to run, you can set up a cron job on your machine ex. Check the ticket price each day at 8:
0 8 * * * python3 /path/to/ticket_bot.py
- Running locally:
python {your path to file}/ticket_bot.py
Thanks to the following sources for guidance/inspo: