From 439716ed67756547999862e641632e89751e1ddf Mon Sep 17 00:00:00 2001 From: Neshura Date: Sun, 27 Nov 2022 18:48:38 +0100 Subject: [PATCH] Try Catch around the ip put New Bug found, uggly patched with this, details in #3 --- cloudflare_script.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cloudflare_script.py b/cloudflare_script.py index ce8c9d3..bc35ff7 100644 --- a/cloudflare_script.py +++ b/cloudflare_script.py @@ -64,8 +64,11 @@ def main(): if fullname in dns_names['A']: new_dnsrecords = {"name": fullname, "type": "A", "content": ip_address_new} print(f"Sending request {new_dnsrecords}") - r = cf.zones.dns_records.patch(zone_id, dns_record_id, data=new_dnsrecords) - print(r) + try; + r = cf.zones.dns_records.patch(zone_id, dns_record_id, data=new_dnsrecords) + print(r) + except: + print("Error pushing entry") case '6': print("Updating IPv6") @@ -84,8 +87,11 @@ def main(): if fullname in dns_names['AAAA']: new_dnsrecords = {"name": fullname, "type": "AAAA", "content": ip_address_new} print(f"Sending request {new_dnsrecords}") - r = cf.zones.dns_records.patch(zone_id, dns_record_id, data=new_dnsrecords) - print(r) + try: + r = cf.zones.dns_records.patch(zone_id, dns_record_id, data=new_dnsrecords) + print(r) + except: + print("Error pushing entry") case 'skipping': print("Done") case other: