From cb74d58432cab7895d5f68cf1ebf71c0123d2c3e Mon Sep 17 00:00:00 2001 From: korenini Date: Fri, 15 Mar 2024 15:04:03 +0100 Subject: [PATCH] Solves the issue #1. --- slup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/slup.py b/slup.py index 1e0948e..7a42d50 100755 --- a/slup.py +++ b/slup.py @@ -10,9 +10,14 @@ def run_update(auth, records): confd = {} confd.update(auth) confd.update(records) - r = requests.get('https://dnsup.sitelutions.com/dnsup', params=confd) - if r.text.strip() != 'success': - print("Encountered an error. API responded with [{}]".format(r.text.strip())) + try: + r = requests.get('https://dnsup.sitelutions.com/dnsup', params=confd) + status = r.text.strip().split("\n") + for s in status: + if s != 'success': + print(f"Encountered an error. API responded with [{s}]") + except ConnectionError, ConnectTimeout: + print("Encountered a problem. Could not connect.") def get_config(filename): config = configparser.ConfigParser()