Python3 script to check the price of a BestBuy product and send an email if it has a sale.
- Install dependencies (
pip install -r requirements.txt
) - Obtain an API key at BestBuy Developer. Note: BestBuy Developer will not grant API keys to users with email addresses from free services like Gmail or Yahoo. You will have to use an email address on a custom domain, such as one from work or school.
- Edit script with API key, product details, and SMTP details.
- Test SMTP email send by manually setting the
message
variable to a non-empty string (e.g "Test email message") and running the script. After verifying that SMTP email send works, undo changes to themessage
variable. - Periodically run the script. Example of crontab entry to run every 20 minutes and log to a file:
*/20 * * * * /usr/bin/python3 /home/user/bestbuy/main.py >> /home/user/bestbuy/cron.log 2>&1
- If ran periodically, multiple emails will be sent for a sale as the script does not remember if it has sent an email already for a sale.