A way to monitor an item on a website and get notified of the price changes
Add modules to /readers
directory that can extract the price from a site. See demo_store.py
as an example.
Caution
NB: FOR PERSONAL USE ONLY! THIS IS NOT SECURE FOR A PRODUCTION SYSTEM!
Which websites are supported?
Each supported website has a corresponding reader
-
Create a
docker-compose.yaml
file:services: pricewatch: image: builder555/pricewatch:latest container_name: pricewatch env_file: - .env volumes: - ./data/:/app/app/db/data/ ports: - 8700:8700
-
Save items-example.json as
items.json
file in thedata
directory (create one if it doesn't exist). -
Put tokens in
.env
file.e.g. for telegram notifier:
TELEGRAM_TOKEN=2223545336:AAAAAAAAAABBBBBBBBBCCCCCCCCCDDDDDDDD TELEGRAM_CHAT_ID=555555555
-
Run it using docker compose:
docker compose up -d
-
Navigate to http://localhost:8700 to add/remove items to monitor.
You should see a page that looks like this:
As long as the container is running, it will check for price changes every 4 hours and send a telegram notification (assuming you have the proper token and chat id).
git clone https://github.com/builder555/pricewatch.git
cd pricewatch
Use compose-dev.yml
:
docker compose -f compose-dev.yml up -d --build
Open http://localhost:8700/ (assuming you didn't override the port) to view the UI.
To build a local docker image:
docker build -t pricewatch .
Then modify the docker-compose.yml file to use it:
image: pricewatch:latest
- python 3.10+
- pipenv
PIPENV_VENV_IN_PROJECT=true pipenv install
cp items-example.json app/db/data/items.json
- For telegram notifier place tokens in
.env
file in thepricewatch
folder (see above). - For demo notifier, modify
notify
function inmain.py
to usedemo_notifier
instead oftelegram_notifier
.
$ PIPENV_VENV_IN_PROJECT=true pipenv shell
$ python main.py
You should see similar output (if using demo notifier):
[2023-10-22 08:04:21.745922] Checking HomeDepot screwdriver set...$29.97
Price has changed!
Demo notifier:
Price has changed for HomeDepot screwdriver set from $9999 to $29.97. Check it out: https://www.homedepot.com/p/Husky-Screwdriver-Set-15-Piece-246340150/204663546
-----
Important
The URL in items-example.json
may not work anymore, delete it and replace with a different one.
To use the UI, run the following:
pipenv shell
python -m app.ui.server
You can set up a cronjob to run periodically
Assumptions:
- the full path to the directory is
/home/me/pricewatch
pipenv
is in/usr/bin/pipenv
0 */4 * * * cd /home/me/pricewatch && /usr/bin/pipenv run start >>log.txt 2>>error.txt