Report connection errors when no response object is available

master
mandlm 2020-06-11 10:47:07 +02:00
parent e97494ec81
commit 4399130373
1 changed files with 6 additions and 1 deletions

View File

@ -33,10 +33,15 @@ def response_successful(response_text):
def ddns_update(host, key, ip): def ddns_update(host, key, ip):
url = f"https://dyndns.strato.com/nic/update?hostname={host}&myip={ip}" url = f"https://dyndns.strato_.com/nic/update?hostname={host}&myip={ip}"
try: try:
response = requests.get(url, auth=(host, key), timeout=3) response = requests.get(url, auth=(host, key), timeout=3)
except RequestException as error:
log.error(error)
return False
try:
response.raise_for_status() response.raise_for_status()
if not response_successful(response.text): if not response_successful(response.text):