Only update A records

This commit is contained in:
Antoine Martin 2023-06-17 15:40:50 -04:00
parent f699af1eef
commit 158b701eb9
Signed by: forge
GPG key ID: D62A472A4AA7D541

View file

@ -36,11 +36,10 @@ def get_sub_records(domain, subdomain, api_url, api_key, debug=False):
return json_object[0] return json_object[0]
def update_sub_records(domain, subdomain, api_url, api_key, ip, ttl, debug=False): def update_sub_records(domain, subdomain, api_url, api_key, ip, ttl, debug=False):
url = api_url + '/domains/' + domain + '/records/' + subdomain url = api_url + '/domains/' + domain + '/records/' + subdomain + "/A"
payload = {"rrset_type": "A", "rrset_ttl": ttl, "rrset_values": [ip]} payload = {"rrset_values": [ip], "rrset_ttl": ttl}
items = {"items": [payload]}
headers = {'Content-Type': 'application/json', 'Authorization': "Apikey " + api_key} 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) json_object = json.loads(resp._content)
return json_object return json_object