--disable-ntfy-logs and --topic TOPIC

This commit is contained in:
2025-06-07 16:58:41 -04:00
parent 5735cd9641
commit 7dd33aca8c
4 changed files with 19 additions and 13 deletions

View File

@ -3,12 +3,14 @@ import requests
from print_t import print_t
class Ntfy:
def __init__(self, server: str):
def __init__(self, server: str, logging_disabled: bool):
self.server = server
self.logging_disabled = logging_disabled
def send(self, message: str):
print_t("Ntfy OUT: " + message)
if not self.logging_disabled:
print_t("Ntfy OUT: " + message)
try:
requests.post(self.server, data=message)
requests.post(self.server, data=message.encode(encoding="utf-8"))
except Exception as err:
print_t(f"\033[31m{err}\033[0m")