Skip to content

Track prices on Amazon and receive email alerts for price drops

Notifications You must be signed in to change notification settings

anfederico/amazon-alert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

External Libraries

matplotlib
numpy
datetime
smtplib
amazonapi

Required Accounts

To do this you'll need two free accounts
1. Amazon Web Services
2. Google Mail

Sgn up for a product advertising account after you create your AWS credentials

Code Examples

Run Once for Initial Setup

from AmazonAlert import addProduct, dailyScan

# ----- Gmail Credentials -----------

# This gives your script access to your gmail account, may want to use a throwaway
# Make sure "Allow Access To Less Secure Apps" is turned on in gmail settings
EMAIL_SELF = '[email protected]'
EMAIL_PASSWORD = 'yourpassword'    

# If using a throwaway, adjust EMAIL_TO to your real email!
EMAIL_FROM = EMAIL_SELF     
EMAIL_TO = EMAIL_SELF
EMAIL_CREDENTIALS = [EMAIL_SELF, EMAIL_PASSWORD, EMAIL_FROM, EMAIL_TO]
 
# ----- Amazon Credentials -----------

AWS_ACCESS_KEY_ID = 'Your AWS Access Key ID'
AWS_SECRET_ACCESS_KEY = 'Your AWS Secret Access Key'
AWS_ASSOCIATE_TAG = 'Your AWS Associate Tag'
AWS_CREDENTIALS = [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_ASSOCIATE_TAG]        

# This file will hold all of our data
csvFile = 'priceHistory.csv'

# Before you start monitoring a product, add it to the data file
# For each product you add, you're also giving directions for a target price

# Xbox Wireless Controller
# Alert when current price drops at least 50%
addProduct('B01GW3H3U8', csvFile, -50, 'percentChange', AWS_CREDENTIALS)  

# Echo Dot
# Alert when current price drops at least 25%
addProduct('B01DFKC2SO', csvFile, -25, 'percentChange', AWS_CREDENTIALS) 

# Halo 5
# Alert when current price drops to at least $19.99
addProduct('B00DB9JV5W', csvFile, 19.99, 'desiredPrice', AWS_CREDENTIALS)

# You can also append new products at a later time to the same data file

priceHistory.csv

B01GW3H3U8|24.755
B01DFKC2SO|37.4925
B00DB9JV5W|19.99

Daily Monitoring of Prices

from AmazonAlert import addProduct, dailyScan

# ----- Gmail Credentials -----------

EMAIL_SELF = '[email protected]'
EMAIL_PASSWORD = 'yourpassword'    
EMAIL_FROM = EMAIL_SELF     
EMAIL_TO = EMAIL_SELF
EMAIL_CREDENTIALS = [EMAIL_SELF, EMAIL_PASSWORD, EMAIL_FROM, EMAIL_TO]
 
# ----- Amazon Credentials -----------

AWS_ACCESS_KEY_ID = 'Your AWS Access Key ID'
AWS_SECRET_ACCESS_KEY = 'Your AWS Secret Access Key'
AWS_ASSOCIATE_TAG = 'Your AWS Associate Tag'
AWS_CREDENTIALS = [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_ASSOCIATE_TAG]        

# You should run this file on a dedicated server once or multiple times a day
# Personally, I run it daily at pythonanywhere.com
# Make sure all products have been properly initalized in the csvFile
# Otherwise they'll be skipped
# If any products fall below their target, you'll receieve an email!

def main():
    csvFile = 'priceHistory.csv'
    products = ['B01GW3H3U8', 'B01DFKC2SO', 'B00DB9JV5W']
    dailyScan(products, csvFile, AWS_CREDENTIALS, EMAIL_CREDENTIALS) 

if __name__ == '__main__':
    main()

Updated priceHistory.csv

B01GW3H3U8|24.755,2016-12-15|49.0
B01DFKC2SO|37.4925,2016-12-15|49.99
B00DB9JV5W|19.99,2016-12-15|24.78

Email Layout

About

Track prices on Amazon and receive email alerts for price drops

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages