From 158b701eb99aa24d3da55801d28dda7f36d3a9e3 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sat, 17 Jun 2023 15:40:50 -0400 Subject: [PATCH] Only update A records --- zoneupdate.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/zoneupdate.py b/zoneupdate.py index 38c4566..3590ade 100644 --- a/zoneupdate.py +++ b/zoneupdate.py @@ -36,11 +36,10 @@ def get_sub_records(domain, subdomain, api_url, api_key, debug=False): return json_object[0] def update_sub_records(domain, subdomain, api_url, api_key, ip, ttl, debug=False): - url = api_url + '/domains/' + domain + '/records/' + subdomain - payload = {"rrset_type": "A", "rrset_ttl": ttl, "rrset_values": [ip]} - items = {"items": [payload]} + url = api_url + '/domains/' + domain + '/records/' + subdomain + "/A" + payload = {"rrset_values": [ip], "rrset_ttl": ttl} headers = {'Content-Type': 'application/json', 'Authorization': "Apikey " + api_key} - resp = requests.put(url, data=json.dumps(items), headers=headers) + resp = requests.put(url, data=json.dumps(payload), headers=headers) json_object = json.loads(resp._content) return json_object