Code Monkey home page Code Monkey logo

price_alert's Introduction

Price_Alert

This script gets the price of a product from Amazon.com and sends out SMS notification if it finds a good deal.

How does this work?

  • It uses Amazon Product Advertising API to get the product's price.
  • If the current price is lower that last purchase's price or yesterday's price, through Twilio, it sends out a text message to the indicated phone numbers.
  • It is scheduled to run on every morning by a Cron job.

Setup

  1. Install all the dependencies for the Amazon API wraper.

  2. Install Twilio module: pip install twilio

  3. Create a new config.py file in same directory:

# config.py
# Amazon credentials:
amazon_key = 'YOUR_AMAZON_KEY'
amazon_secret = 'YOUR_AMAZON_SECRET_KEY'
amazon_tag = 'YOUR_AMAZON_ASSOC_TAG'

# Twilio credentials:
twilio_sid = 'YOUR_TWILIO_SID'
twilio_token = 'YOUR_TWILIO_TOKEN'

# Phone numbers:
from_number = '+1 YOUR_TWILIO_PHONE_NUM'
to_number = '+1 YOUR_PHONE_NUM'
  1. Create a new value.py file in the same directory:
# value.py
# Enter your product name here:
name = 'rapsberry pi'

# Enter the price for this product from your last purchase:
price = '34.99'
  1. Execute the script: python3 main.py.

To set up the cron job:

  1. Type in which python3 to get the directory of python3.

  2. crontab -e

  3. This cron job executes the script everyday at 7:30 AM and print the result to a log file:

30 7 * * * cd /YOUR_PATH ; /PYTHON3_PATH  main.py > /YOUR_PATH/repport.log 2>&1

Sample output:

Best match: Optimum Nutrition Serious Mass, Chocolate, 12 Pound
The current price on Amazon: $47.99 is lower than your last purchase!

Best match: Optimum Nutrition Serious Mass, Chocolate, 12 Pound
The current price on Amazon: $47.99 is lower than yesterday price $51.99

price_alert's People

Contributors

longpotato avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

mindis diwahars

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.