From 5a4b30f7685403a9b1ec94bd95ae10ec8398b48e Mon Sep 17 00:00:00 2001 From: jiriks74 Date: Thu, 16 Jan 2025 15:54:33 +0100 Subject: [PATCH] fix(Nextcloud): Catch SSLEOFError when fetching notifications This happened while the server was down for maintenance. We can most likely just ignore it. Fixes: https://forgejo.stefka.eu/jiriks74/nextcloud2ntfy/issues/7 --- nextcloud2ntfy.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nextcloud2ntfy.py b/nextcloud2ntfy.py index 80c132b..5265c53 100644 --- a/nextcloud2ntfy.py +++ b/nextcloud2ntfy.py @@ -186,10 +186,13 @@ def main(): } while True: log.debug("Fetching notifications.") - response = requests.get( - f"{config["nextcloud_base_url"]}{config["nextcloud_notification_path"]}", - headers=nextcloud_request_headers, - ) + try: + response = requests.get( + f"{config["nextcloud_base_url"]}{config["nextcloud_notification_path"]}", + headers=nextcloud_request_headers, + ) + except requests.exceptions.SSLError as e: + log.error(f"SSL error fetching notifications. Maybe the server/proxy is down?\n{e}") if not response.ok: log.error( f"Error while fetching notifications. Response code: {response.status_code}."