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()}")