From cfeb253cacde6e11f95815b8920f6b604433809d Mon Sep 17 00:00:00 2001 From: Kristian Krsnik Date: Fri, 13 Oct 2023 14:09:03 +0200 Subject: [PATCH] Documentation and fixed a bug with the log --- dyn_gandi/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dyn_gandi/main.py b/dyn_gandi/main.py index 85472d5..cb8044b 100644 --- a/dyn_gandi/main.py +++ b/dyn_gandi/main.py @@ -57,7 +57,7 @@ def loadSettings(path: str | None) -> dict: def log(logline: str, path: str = './log.txt', stdout: bool = False) -> None: ''' - Appends logline at the end of the file file with a timestamp + Appends `logline` at the end of the file file with a timestamp. `logline` The line to log. @@ -130,8 +130,8 @@ def checkRecords(api: dict[str, dict[str, list[str]]], current_ip: str, log: Cal records_to_renew[key][domain] = list(set(records_to_renew[key][domain]) - set(record['rrset_name'] for record in ( filter(lambda x: current_ip in x['rrset_values'], response.json())))) - if records_to_renew[key][domain] != []: - log(f"[INFO][{','.join(records_to_renew)}] Record need to be renewed") + if (records := records_to_renew[key][domain]) != []: + log(f"[INFO][{','.join(records)}] Records need to be renewed") else: log(f"[ERROR][{domain}][{response.status_code}] {response.json()}")