Skip to content

Commit de0bbb4

Browse files
authored
Merge pull request #277 from Der-Henning/dev
bump version 1.15.0
2 parents 7a54b61 + 6e1601c commit de0bbb4

File tree

9 files changed

+140
-93
lines changed

9 files changed

+140
-93
lines changed

DOCKER_README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Readme, source and documentation on [https://github.com/Der-Henning/tgtg](https:
1010

1111
- [`edge`](https://github.com/Der-Henning/tgtg/blob/main/Dockerfile)
1212
- [`edge-alpine`](https://github.com/Der-Henning/tgtg/blob/main/Dockerfile.alpine)
13-
- [`v1`, `v1.14`, `v1.14.10`, `latest`](https://github.com/Der-Henning/tgtg/blob/v1.14.10/Dockerfile)
14-
- [`v1-alpine`, `v1.14-alpine`, `v1.14.10-alpine`, `latest-alpine`](https://github.com/Der-Henning/tgtg/blob/v1.14.10/Dockerfile.alpine)
13+
- [`v1`, `v1.15`, `v1.15.0`, `latest`](https://github.com/Der-Henning/tgtg/blob/v1.15.0/Dockerfile)
14+
- [`v1-alpine`, `v1.15-alpine`, `v1.15.0-alpine`, `latest-alpine`](https://github.com/Der-Henning/tgtg/blob/v1.15.0/Dockerfile.alpine)
1515

1616
# Quick Start
1717

@@ -28,13 +28,15 @@ services:
2828
- DEBUG=false
2929
- TGTG_USERNAME=
3030
- SLEEP_TIME=60
31-
- SCHEDULE_CRON=
32-
- ITEM_IDS=
31+
#- SCHEDULE_CRON=
32+
#- ITEM_IDS=
3333
- METRICS=false
3434
- METRICS_PORT=8000
3535
- DISABLE_TESTS=false
36+
- QUIET=false
37+
- LOCALE=en_US
3638

37-
- SMTP=true
39+
- SMTP=false
3840
- SMTP_HOST=smtp.gmail.com
3941
- SMTP_PORT=465
4042
@@ -52,7 +54,7 @@ services:
5254
- TELEGRAM=false
5355
- TELEGRAM_TOKEN=
5456
- TELEGRAM_CHAT_IDS=
55-
- TELEGRAM_TIMEOUT=60
57+
#- TELEGRAM_TIMEOUT=60
5658
#- TELEGRAM_BODY=
5759

5860
- IFTTT=false
@@ -63,8 +65,10 @@ services:
6365
- WEBHOOK_URL=
6466
- WEBHOOK_METHOD=POST
6567
- WEBHOOK_BODY=
66-
- WEBHOOK_TYPE=
67-
- WEBHOOK_TIMEOUT=60
68+
- WEBHOOK_TYPE=plain/text
69+
#- WEBHOOK_HEADERS=
70+
#- WEBHOOK_TIMEOUT=60
71+
#- WEBHOOK_CRON=
6872
volumes:
6973
- tokens:/tokens
7074

README.md

Lines changed: 68 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -15,63 +15,100 @@ This software is provided as is without warranty of any kind. If you have proble
1515

1616
## Disclaimer
1717

18-
Too Good To Go explicitly forbids the use of their platform the way this tool does. In their Terms and Conditions it says: "The Consumer must not misuse the Platform (including hacking or 'scraping')."
18+
This Project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Too Good To Go, or any of its subsidiaries or its affiliates.
1919

20-
If you use this tool you do it at your own risk. TGTG may stop you from doing so by (temporarily) blocking your access and may even delete your account.
20+
Too Good To Go explicitly forbids the usege of their platform the way this tool does if you use it. In their Terms and Conditions it says: "The Consumer must not misuse the Platform (including hacking or 'scraping')."
21+
22+
If you use this tool you do it at your own risk. Too Good To Go may stop you from doing so by (temporarily) blocking your access and may even delete your account.
2123

2224
## Error 403
2325

2426
If you see the Error 403 in your logs please refer to the [FAQ](https://github.com/Der-Henning/tgtg/wiki/FAQ#1-i-am-getting-error-403-all-the-time).
2527

2628
## Installation
2729

28-
You can install this tool on any computer. For 24/7 notifications I recommended to install the tool on a NAS like Synology or a Raspberry Pi. You can also use a virtual cloud server. Starting at 1,00 €/Month at Strato.de or try AWS free tier.
30+
You can install this tool on any computer. For 24/7 notifications I recommended to an installation on a NAS like Synology or a Raspberry Pi. You can also try to use a virtual cloud server.
2931

3032
If you have any problems or questions feel free to create an issue.
3133

34+
For configuration options see [`config.sample.ini`](https://github.com/Der-Henning/tgtg/blob/main/src/config.sample.ini) or [`docker-compose.yml`](https://github.com/Der-Henning/tgtg/blob/main/docker-compose.yml).
35+
3236
You have the following three options to install the scanner, ascending in complexity:
3337

3438
### Use prebuild Release
3539

3640
This is the simplest but least flexible solution suitable for most operating systems.
3741

42+
The binaries are build for Linux, MacOS and Windows running on a `x64` architecture. If you are using an other architecture like `arm` (e.g. Raspberry Pi) you have to run from source, compile the binary yourself or use the docker images.
43+
3844
1. Download latest [Releases](https://github.com/Der-Henning/tgtg/releases) for your OS
3945
2. Unzip the archive
40-
3. Edit ```config.ini``` as described in the file
46+
3. Edit `config.ini` as described in the file
4147
4. Run scanner
4248

43-
You can run the scanner manually if you need it, add it to your system startup or create a service.
49+
You can run the scanner manually if you need it, add it to your startup or create a system service.
4450

4551
The executables for Windows and MacOS are not signed by Microsoft and Apple, which would be very expensive.
4652
On Mac you need to hold the control key while opening the file and on Windows you need to confirm the displayed dialog.
4753

4854
### Run with Docker
4955

50-
My preferred method for servers using the pre build multi-arch linux images available on [Docker Hub](https://hub.docker.com/r/derhenning/tgtg).
56+
My preferred method for servers, NAS and RapsberryPis is using the pre build multi-arch linux images available via [Docker Hub](https://hub.docker.com/r/derhenning/tgtg). The images are build for linux on `amd64`, `arm64`, `armv7`, `armv6` and `i386`.
5157

5258
1. Install Docker and docker-compose
53-
2. Copy and edit ```docker-compose.yml``` as described in the file
54-
3. Run ```docker-compose up -d```
59+
2. Copy and edit `docker-compose.yml` as described in the file
60+
3. Run `docker-compose up -d`
5561

56-
The container creates a volume mounting ```\tokens``` where the app saves the TGTG credentials after login. These credentials will be reused on every start of the container to avoid the mail login process. To login with a different account you have to delete the created volume.
62+
The container automatically creates a volume mounting `\tokens` where the app saves the TGTG credentials after login. These credentials will be reused on every start of the container to avoid the mail login process. To login with a different account you have to delete the created volume or the files in it.
5763

5864
### Run from source
5965

60-
Method for developers.
66+
Method for advanced usage.
67+
68+
1. Install Python>=3.9 and pip
69+
2. Run `pip install -r requirements.txt`
70+
3. Create `src/config.ini` as described in the file `config.template.ini`
71+
4. Run `python src/main.py`
72+
73+
Alternatively you can use environment variables as described in the `sample.env` file. The scanner will look for environment variables if no `config.ini` is present.
74+
75+
### Build your own binary
76+
77+
You could also build your own binary for your OS/Arch combination.
6178

6279
1. Install Python>=3.9 and pip
63-
2. Run ```pip install -r requirements.txt```
64-
3. Create ```src/config.ini``` as described in the file ```config.template.ini```
65-
4. Run ```python src/main.py```
80+
2. Run `pip install -r requirements-build.txt`
81+
3. Run `make executable` or `pyinstaller scanner.spec`
6682

67-
Alternatively you can use environment variables as described in the ```sample.env``` file. The scanner will look for environment variables if no ```config.ini``` is present.
83+
You will find the bundled binary including the `config.ini` in the `./dist` directory.
6884

69-
### Running
85+
## Usage
7086

7187
When the scanner is started it will first try to login to your TGTG account. Similar to logging in to the TGTG app, you have to click on the link send to you by mail. This won't work on your mobile phone if you have installed the TGTG app, so you have to check your mailbox on PC.
7288

7389
After a successful login the scanner will send a test notification on all configured notifiers. If you don't receive any notifications, please check your configuration.
7490

91+
### Helper functions
92+
93+
The executable or the `src/main.py` contains some useful helper functions that can be accessed via optional command line arguments. Running `scanner(.exe) --help` or `python src/main.py --help` displays the available commands.
94+
95+
````
96+
usage: main.py [-h] [-v] [-d] [-t] [-f] [-F] [-a item_id [item_id ...]] [-r item_id [item_id ...]] [-R]
97+
98+
optional arguments:
99+
-h, --help show this help message and exit
100+
-v, --version show program's version number and exit
101+
-d, --debug activate debugging mode
102+
-t, --tokens display your current access tokens and exit
103+
-f, --favorites display your favorites and exit
104+
-F, --favorite_ids display the item ids of your favorites and exit
105+
-a item_id [item_id ...], --add item_id [item_id ...]
106+
add item ids to favorites and exit
107+
-r item_id [item_id ...], --remove item_id [item_id ...]
108+
remove item ids from favorites and exit
109+
-R, --remove_all remove all favorites and exit
110+
````
111+
75112
### Metrics
76113

77114
Enabling the metrics option will expose a http server on the specified port supplying the currently available items. You can scrape the data with prometheus to create and visualize historic data or use it with your home automation.
@@ -88,54 +125,31 @@ Scrape config:
88125
- 'localhost:8000'
89126
````
90127

91-
## Developing
128+
## Developement
92129

93-
For development I recommend using docker. The Makefile depends on docker and docker-compose.
130+
For development I recommend using docker.
94131

95-
Create ```.env``` based on ```sample.env``` for configuration.
132+
If you are developing with VSCode, you can open the project in the configured development container.
96133

97-
Developing with VSCode you can open the project in the configured development container.
98-
99-
### Makefile commands
100-
101-
```make image``` builds docker image with tag ```tgtg-scanner:latest```
102-
103-
```make install``` installs dependencies
104-
105-
```make start``` short for ```python src/main.py```
106-
107-
```make bash``` starts dev python docker image with installed dependencies and mounted project in bash
108-
109-
```make executable``` creates bundled executable in ```/dist```
110-
111-
```make test``` runs unit tests
112-
113-
```make clean``` cleans up docker compose
114-
115-
### Helper functions
116-
117-
```src/main.py``` contains some useful helper functions that can be accessed via optional command line arguments. Running ```python src/main.py --help``` displays the available commands.
134+
To install all required dependencies for the developement environment, including linting, testing and building, run
118135

136+
````bash
137+
pip install -r requirements-dev.txt
119138
````
120-
usage: main.py [-h] [-v] [-d] [-t] [-f] [-F] [-a item_id [item_id ...]] [-r item_id [item_id ...]] [-R]
121139

122-
optional arguments:
123-
-h, --help show this help message and exit
124-
-v, --version show program's version number and exit
125-
-d, --debug activate debugging mode
126-
-t, --tokens display your current access tokens and exit
127-
-f, --favorites display your favorites and exit
128-
-F, --favorite_ids display the item ids of your favorites and exit
129-
-a item_id [item_id ...], --add item_id [item_id ...]
130-
add item ids to favorites and exit
131-
-r item_id [item_id ...], --remove item_id [item_id ...]
132-
remove item ids from favorites and exit
133-
-R, --remove_all remove all favorites and exit
134-
````
140+
### Makefile commands
141+
142+
- `make image` builds docker image with tag `tgtg-scanner:latest`
143+
- `make install` installs dependencies
144+
- `make start` short for `python src/main.py`
145+
- `make bash` starts dev python docker image with installed dependencies and mounted project in bash
146+
- `make executable` creates bundled executable in `/dist`
147+
- `make test` runs unit tests
148+
- `make clean` cleans up docker compose
135149

136150
### Creating new notifiers
137151

138-
Feel free to create and contribute new notifiers for other services and endpoints. You can use an existing notifier as template.
152+
Feel free to create and contribute new notifiers for other services and endpoints. You can use an existing notifier as template or build upon the webhook notifier. E.g. see the [ifttt notifier](https://github.com/Der-Henning/tgtg/blob/main/src/notifiers/ifttt.py).
139153

140154
---
141155
If you want to support me, feel free to buy me a coffee.

docker-compose.dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ services:
55
context: .
66
dockerfile: Dockerfile.dev
77
working_dir: /home/app
8-
env_file:
9-
- .env
8+
# env_file:
9+
# - .env
1010
volumes:
1111
- .:/home/app
1212
stdin_open: true

docker-compose.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ services:
1818
- METRICS=false ## Enable to export metrics for Prometheus
1919
- METRICS_PORT=8000 ## Port for metrics http server
2020
- DISABLE_TESTS=false ## true to disable test notifications on startup
21-
- quiet=false ## true to disable all console messages. Only errors and console notifier messages
21+
- QUIET=false ## true to disable all console messages. Only errors and console notifier messages
22+
- LOCALE=en_US ## set locale to localize ${{pickupdate}}
2223

2324
- CONSOLE=false ## true = enable simple console notifications
2425
#- CONSOLE_BODY= ## console message with variables as described below
@@ -33,18 +34,21 @@ services:
3334
- SMTP_SSL=false ## enable SSL
3435
- [email protected] ## sender adress - same as Login for google and most smtp servers
3536
- [email protected] ## recipient for notifications - can be the same as sender
36-
#-SMTP_SUBJECT= ## Subject and Body options are optional.
37-
#-SMTP_BODY= ## Subject and Body options can use variables as described below
37+
#- SMTP_CRON=
38+
#- SMTP_SUBJECT= ## Subject and Body options are optional.
39+
#- SMTP_BODY= ## Subject and Body options can use variables as described below
3840
## The Body option is interpreted as HTML
3941

4042
- PUSH_SAFER=false ## true = enable notifications via pushsafer.com
4143
- PUSH_SAFER_KEY=
4244
- PUSH_SAFER_DEVICE_ID=
45+
#- PUSH_SAFER_CRON=
4346

4447
- TELEGRAM=false ## true = enable notifications via Telegram
4548
- TELEGRAM_TOKEN= ## Telegram Bot token - see @botfather
4649
- TELEGRAM_CHAT_IDS= ## Telegram Chat id, multiple ids separated by comma
4750
- TELEGRAM_TIMEOUT=60 ## Timeout for Telegram API requests
51+
#- TELEGRAM_CRON=
4852
#- TELEGRAM_BODY= ## Optional message body as markdown, variables as described below
4953
## Example:
5054
## 'TELEGRAM_BODY=*$${{display_name}}*\n*Available*: $${{items_available}}\n*Rating*: $${{rating}}\n*Price*: $${{price}} $${{currency}}\n*Pickup*: $${{pickupdate}}'
@@ -54,6 +58,7 @@ services:
5458
- IFTTT=false ## true = enable notifications via IFTTT Webhooks
5559
- IFTTT_EVENT=tgtg_notification ## IFTTT Webhooks Event
5660
- IFTTT_KEY= ## IFTTT Webhooks Key
61+
#- IFTTT_CRON=
5762
- IFTTT_BODY= ## IFTTT json data body
5863
## Default: {"value1": "$${{display_name}}", "value2": $${{items_available}}, "value3": "https://share.toogoodtogo.com/item/$${{item_id}}"}
5964

@@ -69,6 +74,7 @@ services:
6974
- WEBHOOK_TYPE=application/json ## Content-Type for header, default: text/plain
7075
- WEBHOOK_HEADERS={} ## Additional headers
7176
- WEBHOOK_TIMEOUT=60 ## Request Timeout
77+
#- WEBHOOK_CRON=
7278
volumes:
7379
- tokens:/tokens ## volume to save TGTG credentials to reuse on next start up and avoid login mail
7480
volumes:

sample.env

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ ITEM_IDS=
66
METRICS=false
77
METRICS_PORT=8000
88
DISABLE_TESTS=false
9+
QUIET=false
910
LOCALE=en_US
1011

1112
TGTG_USERNAME=
1213
TGTG_ACCESS_TOKEN=
1314
TGTG_REFRESH_TOKEN=
1415
TGTG_USER_ID=
16+
TGTG_DATADOME=
17+
18+
CONSOLE=false
19+
CONSOLE_BODY=
20+
CONSOLE_CRON=
1521

1622
SMTP=false
1723
SMTP_HOST=smtp.gmail.com
@@ -22,25 +28,30 @@ SMTP_TLS=true
2228
SMTP_SSL=false
2329
SMTP_SENDER=
2430
SMTP_RECIPIENT=
31+
SMTP_CRON=
2532

2633
PUSH_SAFER=false
2734
PUSH_SAFER_KEY=
2835
PUSH_SAFER_DEVICE_ID=
36+
PUSH_SAFER_CRON=
2937

3038
IFTTT=false
3139
IFTTT_EVENT=tgtg_notification
3240
IFTTT_BODY=
3341
IFTTT_KEY=
42+
IFTTT_CRON=
3443

3544
TELEGRAM=false
3645
TELEGRAM_TOKEN=
3746
TELEGRAM_CHAT_IDS=
3847
TELEGRAM_TIMEOUT=60
3948
TELEGRAM_BODY=
49+
TELEGRAM_CRON=
4050

4151
WEBHOOK=false
4252
WEBHOOK_URL=
4353
WEBHOOK_METHOD=POST
4454
WEBHOOK_BODY=
4555
WEBHOOK_TYPE=
4656
WEBHOOK_TIMEOUT=60
57+
WEBHOOK_CRON=

src/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__title__ = "TGTG Scanner"
22
__description__ = "Provides notifications for TGTG magic bags"
3-
__version__ = "1.14.10"
3+
__version__ = "1.15.0"
44
__author__ = "Henning Merklinger"
55
__author_email__ = "[email protected]"
66
__license__ = "GPL"

0 commit comments

Comments
 (0)