A fork of LauPaSat-pl/TGTG notifications, and inspired by Der-Henning/tgtg and kacpi2442/am_bot
1. Github Actions | 2. Self-hosted | |
---|---|---|
Status | 🟩 Fully working | 🟨 WIP |
Runs on | Github servers | Your server |
- Features: | ---------- | ---------- |
Easy setup | ✅ | 🟨1 |
Notifies available items | ✅ | ✅ |
Shows price of items | ✅ | ✅ |
Shows quantity available | ✅ | ✅ |
Shows store location | ✅ | ✅ |
Shows description | ✅ | ✅ |
Link to open app | ✅ | ✅ |
Prevents repetition2 | ❌ | ✅ |
...3 | ❌ | ✅ |
- Create a new Telegram bot using BotFather tutorial -> get your
TG_BOT_ID
, - Check your Telegram ID tutorial -> this will be your
TG_CHAT_ID
, - Install the
tgtg
Python library
pip install tgtg
- Run with
python
from tgtg import TgtgClient
client = TgtgClient(email="[email protected]")
credentials = client.get_credentials()
You should receive an email from TooGoodToGo. The client will wait until you validate the login by clicking the link inside the email.
Once you clicked the link, you will get credentials and be able to see them with:
print(credentials)
They will look like this:
{
'access_token': '<your_access_token>',
'refresh_token': '<your_refresh_token>',
'user_id': '<your_user_id>',
'cookie': '<cookie>',
}
These will be your TGTG ACCESS_TOKEN
, REFRESH_TOKEN
, TGTG_USER_ID
, and COOKIE
.
This runs 100% automatically on Github Actions (not counting the set up), to check for your favourite available TooGoodToGo items and send you a Telegram message about it. You can make it run periodically, for example every 15 minutes.
- Fork this repo,
- In your repo add secrets (tutorial) you got from earlier steps (TooGoodToGo and Telegram), you can check how to name them in
notitications.yml
file,
[DO NOT PUT THEM VISIBLE IN.py
or.yml
FILES DIRECTLY OR ELSE YOU WILL HAVE TO REVOKE YOUR CREDENTIALS AND DELETE YOUR FORK] - [Optional] Change the schedule in the
.github/workflows/notifications.yml
file, - Make sure it's up and running. Done!
[WIP]
TODO
TODO
clone
.env.template -> .env
docker?
...
Getting a tgtg.exceptions.TgtgAPIError: (403, b'{"url"...
error ? You are getting blocked by the TooGoodToGo API by their bot prevention, try sending requests less frequently or wait a couple hours. (More info or solutions at the tgtg-python repo)