Add authentication to ntfy

This commit is contained in:
Mike Cifelli 2023-07-03 12:23:15 -04:00
parent 3f965f7669
commit ab5c6d6afa
Signed by: mike
GPG Key ID: 6B08C6BE47D08E4C
2 changed files with 3 additions and 1 deletions

View File

@ -9,3 +9,4 @@ lon=lon
uri=uri uri=uri
ntfy=ntfy.sh ntfy=ntfy.sh
topic=topic topic=topic
auth=auth

View File

@ -11,8 +11,9 @@ class GarageListener:
ntfy = config['garage'].get('ntfy') ntfy = config['garage'].get('ntfy')
topic = config['garage'].get('topic') topic = config['garage'].get('topic')
auth = config['garage'].get('auth')
self.ntfyUri = f'https://{ntfy}/{topic}/json' self.ntfyUri = f'https://{ntfy}/{topic}/json?auth={auth}'
def listenForNotifications(self, queue): def listenForNotifications(self, queue):
with requests.get(self.ntfyUri, stream=True, timeout=60) as response: with requests.get(self.ntfyUri, stream=True, timeout=60) as response: