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: