Skip to content

Commit db27c25

Browse files
authored
Merge pull request #298 from Der-Henning/dev
bump version 1.16.0
2 parents 70175bf + fde28a4 commit db27c25

File tree

8 files changed

+26
-20
lines changed

8 files changed

+26
-20
lines changed

DOCKER_README.md

Lines changed: 2 additions & 2 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.15`, `v1.15.2`, `latest`](https://github.com/Der-Henning/tgtg/blob/v1.15.2/Dockerfile)
14-
- [`v1-alpine`, `v1.15-alpine`, `v1.15.2-alpine`, `latest-alpine`](https://github.com/Der-Henning/tgtg/blob/v1.15.2/Dockerfile.alpine)
13+
- [`v1`, `v1.16`, `v1.16.0`, `latest`](https://github.com/Der-Henning/tgtg/blob/v1.16.0/Dockerfile)
14+
- [`v1-alpine`, `v1.16-alpine`, `v1.16.0-alpine`, `latest-alpine`](https://github.com/Der-Henning/tgtg/blob/v1.16.0/Dockerfile.alpine)
1515

1616
# Quick Start
1717

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ pip install -r requirements-dev.txt
169169
- `make bash` starts dev python docker image with installed dependencies and mounted project in bash
170170
- `make executable` creates a bundled executable in `/dist`
171171
- `make test` runs unit tests
172+
- `make lint` run pre-commit hooks
172173
- `make clean` cleans up docker-compose
173174

174175
### Creating new notifiers

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.15.2"
3+
__version__ = "1.16.0"
44
__author__ = "Henning Merklinger"
55
__author_email__ = "[email protected]"
66
__license__ = "GPL"

src/notifiers/apprise.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ def _send(self, item: Item) -> None:
3939
body = item.unmask(self.body)
4040

4141
log.debug("Apprise url: %s", url)
42-
log.debug("Apprise Title: %s", title)
43-
log.debug("Apprise Body: %s", body)
42+
log.debug("Apprise title: %s", title)
43+
log.debug("Apprise body: %s", body)
4444

4545
apobj = apprise.Apprise()
4646
apobj.add(self.url)
4747
apobj.notify(title=title, body=body)
48+
apobj.clear()
4849

4950
def __repr__(self) -> str:
50-
return f"Apprise {self.url}"
51+
return f"Apprise: {self.url}"

src/notifiers/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ def __init__(self, config: Config):
1212
self.enabled = False
1313
self.cron = Cron()
1414

15+
@property
16+
def name(self):
17+
return self.__class__.__name__
18+
1519
def send(self, item: Item) -> None:
1620
if self.enabled and self.cron.is_now:
17-
log.debug("Sending %s Notification", self.__class__.__name__)
21+
log.debug("Sending %s Notification", self.name)
1822
self._send(item)
1923

2024
@abstractmethod

src/notifiers/ntfy.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class Ntfy(WebHook):
13-
"""Notifier for ntfy"""
13+
"""Notifier for Ntfy"""
1414

1515
def __init__(self, config: Config):
1616
self.enabled = config.ntfy.get("enabled", False)
@@ -36,13 +36,13 @@ def __init__(self, config: Config):
3636
if not self.server or not self.topic:
3737
raise NtfyConfigurationError()
3838
self.url = f"{self.server}/{self.topic}"
39-
log.debug("ntfy url: %s", self.url)
39+
log.debug("Ntfy url: %s", self.url)
4040
if (self.username and self.password) is not None:
4141
self.auth = HTTPBasicAuth(self.username, self.password)
42-
log.debug("Using basic auth with user '%s' for ntfy",
42+
log.debug("Using basic auth with user '%s' for Ntfy",
4343
self.username)
44-
else:
45-
log.warning("Username or Password missing for ntfy "
44+
elif (self.username or self.password) is not None:
45+
log.warning("Username or Password missing for Ntfy "
4646
"authentication, defaulting to no auth")
4747
try:
4848
Item.check_mask(self.title)
@@ -53,7 +53,7 @@ def __init__(self, config: Config):
5353
raise NtfyConfigurationError(exc.message) from exc
5454

5555
def _send(self, item: Item) -> None:
56-
"""Sends item information via configured ntfy endpoint"""
56+
"""Sends item information via configured Ntfy endpoint"""
5757
title = item.unmask(self.title).encode("utf-8")
5858
message = item.unmask(self.message).encode("utf-8")
5959
tags = item.unmask(self.tags).encode("utf-8")
@@ -68,4 +68,4 @@ def _send(self, item: Item) -> None:
6868
super()._send(item)
6969

7070
def __repr__(self) -> str:
71-
return f"ntfy: {self.server}/{self.topic}"
71+
return f"Ntfy: {self.server}/{self.topic}"

src/notifiers/telegram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _unmute(self, update: Update, context: CallbackContext) -> None:
120120

121121
def _error(self, update: Update, context: CallbackContext) -> None:
122122
"""Log Errors caused by Updates."""
123-
log.warning('Update "%s" caused error "%s"', update, context.error)
123+
log.debug('Update "%s" caused error "%s"', update, context.error)
124124

125125
def _get_chat_id(self) -> None:
126126
"""Initializes an interaction with the user

src/notifiers/webhook.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(self, config: Config):
4242
def _send(self, item: Item) -> None:
4343
"""Sends item information via configured Webhook endpoint"""
4444
url = item.unmask(self.url)
45-
log.debug("%s url: %s", self.__class__.__name__, url)
45+
log.debug("%s url: %s", self.name, url)
4646
body = None
4747
headers = self.headers
4848
if self.type:
@@ -53,15 +53,15 @@ def _send(self, item: Item) -> None:
5353
body = json.dumps(json.loads(body.replace('\n', '\\n')))
5454
else:
5555
body = body.encode('utf-8')
56-
log.debug("%s body: '%s'", self.__class__.__name__, body)
57-
log.debug("%s headers: %s", self.__class__.__name__, headers)
56+
log.debug("%s body: %s", self.name, body)
57+
log.debug("%s headers: %s", self.name, headers)
5858
res = requests.request(method=self.method, url=url,
5959
timeout=self.timeout, data=body,
6060
headers=headers, auth=self.auth)
6161
if not res.ok:
6262
log.error("%s Request failed with status code %s",
63-
self.__class__.__name__, res.status_code)
64-
log.debug("Response content: %s", res.text)
63+
self.name, res.status_code)
64+
log.debug("%s Response content: %s", self.name, res.text)
6565

6666
def __repr__(self) -> str:
6767
return f"WebHook: {self.url}"

0 commit comments

Comments
 (0)