Skip to main content

Periodically check your Amazon wishlist for price reductions.

Project description

Amazon Wishlist Pricewatch

MIT License PyPI PyPI

Periodically check your public Amazon wishlist for price reductions.

This package will send you a notification (SMTP email and/or telegram) each time a product on your publicly available wishlist reaches a new lowest price. Price still not low enough? You'll only receive another notification for the same product when the price drops further.

Pip install the package, fill in the configuration file and schedule to run with your preferred task scheduler. E.g. Windows Task Scheduler / launchd (Mac OS) / cron (Mac OS / Unix).

Uses the wonderful requests and BeautifulSoup4. No need for the overhead of a headless browser as all data can be gathered from the plain html.

Table of Contents

How It Works

Once installed and configured, each run of pricewatch downloads and stores your wishlist as JSON and does price comparisons against items seen in previous runs. When a new lowest price for a product is seen you receive a notification, and the new price is saved to JSON for future runs.

Schedule the script to run as often as you like with Task Scheduler/launchd/cron, and you're good to go.

Getting Started

Prerequisites

Python >=3.8

Installation

Install with pip (recommended):

  pip install amazon-wishlist-pricewatch
  pricewatch

Or clone the git repo:

  git clone https://github.com/sam0jones0/amazon_wishlist_pricewatch.git
  cd amazon_wishlist_pricewatch
  pip install -r requirements.txt
  cd ./amazon_wishlist_pricewatch
  python3 ./pricewatch.py

(Optional) If you want telegram notifications:

  pip install python-telegram-bot

Set Configuration

Fill in the config file located at amazon_wishlist_pricewatch/config.json

If you can't find it enter pricewatch (or python3 ./pricewatch.py if you cloned the repo) into your console. Location of the file will be printed.

Detailed config file documentation here.

Test Notifications

In config.json Set send_test_notification to "1" and run pricewatch. A test notification(s) should be sent and pricewatch will exit. Remember to set back to "0" once you're done.

Set Running Schedule

You can use any task scheduler you like to run pricewatch / pricewatch.py Here's a few suggestions.

Windows

I recommend using "Windows Task Scheduler". You can use the GUI or for e.g. to create a task that runs once each time the system boots enter the following into an elevated (Run as Administrator) cmd.exe/Powershell.

  schtasks /create /tn "Amazon Wishlist Pricewatch" /tr "C:\Path\To\Your\Python\exe\python.exe D:\Path\To\amazon-wishlist-pricewatch\amazon_wishlist_pricewatch\pricewatch.py" /sc onstart /RU WindowsUserName /RP WindowsPassword

More examples and guidance on setting different schedules here

Mac OS

You can use cron, launchd, automator or any other tool. For e.g. to use launchd to create a task that runs once each time the system boots create the following file ~/Library/LaunchAgents/local.amazonwishlistpricewatch.pricewatch.plist and paste in:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>local.amazonwishlistpricewatch.pricewatch.plist</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/bin/python3</string>
		<string>/path/to/amazon_wishlist_pricewatch/pricewatch.py</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
</dict>
</plist>

More information on launchd here

Unix/Linux

I assume you'll be fine! Perhaps use cron.

Config File Documentation

Annotated example config file contents:

  {
  "general": {
    "notification_mode": "12 (1 for email + 2 for telegram)",
    "wishlist_url": "https://www.amazon.co.uk/hz/wishlist/ls/S0M3C0D3",
    "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0",
    "send_test_notification": "0"
  },
  "email": {
    "smtp_server": "YOUR-SMTP-SERVER (e.g. smtp.gmail.com)",
    "smtp_port": "YOUR-SMTP-SSL-PORT (e.g. 465 for gmail)",
    "sending_email": "SENDING EMAIL ADDRESS (e.g. example@gmail.com)",
    "sending_email_pass": "SENDING EMAIL ADDRESS PASSWORD",
    "receiving_emails": [
      "person1@gmail.com",
      "person2@optional.com"
    ]
  },
  "telegram": {
    "chat_id": "1234567890",
    "token": "9876543210:HFusj898IEXAMPLEHDKEIIE83exampleuUJ"
  }
}

Notification Mode

  • "1" for email.
  • "2" for Telegram.
  • "12" for email and Telegram.

Send Test Notification

Set to "1" to have the script attempt to send a notification to each method specified and then exit. Change back to "0" to have the script run normally.

Using Gmail

If you have 2FA enabled you can create an app password and put that in sending_email_pass.

Not recommended, but you can use your usual Google account password if you enable "Less secure app access". I'd recommend creating a new Gmail account if you do this.

Using Telegram

  1. Download / install Telegram.
  2. Create a bot with Telegram's BotFather bot and keep a note of the token.
  3. Create a new group where you will receive notifications and add your new bot to it.
  4. Send at least one message to the group.
  5. Visit https://api.telegram.org/botXXX:YYYYY/getUpdates replacing XXX:YYYYY with your token from step 2 and take a note of the chat id.
  6. Add your chat id and token to config.json.

User Agent

You don't need to change this, but you can. Enter "my user agent" into Google to see your browser's user agent.

Questions, Suggestions and Bugs

Feel free to open an issue here.

Contributing / Development

Contributions welcome.

Clone the repo and pip install -r requirements_dev.txt in a new virtual environment.

Uses pytest for testing, Mypy for type checking, and black for code formatting.

License

MIT License. Sam Jones

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

amazon_wishlist_pricewatch-0.1.24.tar.gz (38.7 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file amazon_wishlist_pricewatch-0.1.24.tar.gz.

File metadata

  • Download URL: amazon_wishlist_pricewatch-0.1.24.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.7

File hashes

Hashes for amazon_wishlist_pricewatch-0.1.24.tar.gz
Algorithm Hash digest
SHA256 46c3f8e96fe8c8bbd36c378387e4d05ceff52c6cb9a950675ddc8b97f160d4a9
MD5 dab925e2d63f3e8771bcb769e80c6d50
BLAKE2b-256 0594beb063b309f2eb6378d9131d931b8c784201d3869ee476491a1ea38ebec4

See more details on using hashes here.

File details

Details for the file amazon_wishlist_pricewatch-0.1.24-py3-none-any.whl.

File metadata

  • Download URL: amazon_wishlist_pricewatch-0.1.24-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.7

File hashes

Hashes for amazon_wishlist_pricewatch-0.1.24-py3-none-any.whl
Algorithm Hash digest
SHA256 221f970a2fd8e323e3fe750df33211327bf582aff97e791dd29face52f7b9a80
MD5 a16566561b64916ba996ef8dfed58044
BLAKE2b-256 4f9fa388817bae1a49ca1936ae194001940f638887ce7cf806931db08bd48401

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page