From 08a02dde6db6b138b25952e7145e2f514c4d63c0 Mon Sep 17 00:00:00 2001 From: changeme Date: Thu, 25 Jun 2020 20:09:41 +0200 Subject: [PATCH 1/2] Log ip --- src/ddns_update.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ddns_update.py b/src/ddns_update.py index 9de2843..50a51b5 100755 --- a/src/ddns_update.py +++ b/src/ddns_update.py @@ -46,7 +46,7 @@ def ddns_update(host, key, ip): response.raise_for_status() if not response_successful(response.text): - raise RequestException("update failed") + raise RequestException(f"update to {ip} failed") except RequestException as error: log.error(response.text.strip()) @@ -54,7 +54,7 @@ def ddns_update(host, key, ip): return False log.debug(response.text.strip()) - log.info("update successful") + log.info("update to {ip} successful") return True @@ -72,7 +72,7 @@ def ddns_update(host, key, ip): ) def loop_ddns_update(host, key): last_ip = socket.getaddrinfo(host, None, socket.AF_INET6)[0][4][0] - log.debug(f"current registered address: {last_ip}") + log.info(f"currently registered address: {last_ip}") while True: current_ip = get_global_ipv6() From 4c62fa13ad4bf6c3e4791c53da3db337585ab537 Mon Sep 17 00:00:00 2001 From: changeme Date: Thu, 25 Jun 2020 20:17:24 +0200 Subject: [PATCH 2/2] Fixed logging and ip comparison --- src/ddns_update.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ddns_update.py b/src/ddns_update.py index 50a51b5..befd4ae 100755 --- a/src/ddns_update.py +++ b/src/ddns_update.py @@ -54,7 +54,7 @@ def ddns_update(host, key, ip): return False log.debug(response.text.strip()) - log.info("update to {ip} successful") + log.info(f"update to {ip} successful") return True @@ -71,7 +71,7 @@ def ddns_update(host, key, ip): help="The ddns authorization key", ) def loop_ddns_update(host, key): - last_ip = socket.getaddrinfo(host, None, socket.AF_INET6)[0][4][0] + last_ip = ip_address(socket.getaddrinfo(host, None, socket.AF_INET6)[0][4][0]) log.info(f"currently registered address: {last_ip}") while True: