changed api call to not overwrite records
This commit is contained in:
parent
993c960aea
commit
f7d5a7d59f
@ -79,11 +79,8 @@ def checkRecords(api: dict[str, dict[str, list[str]]], current_ip: str, log: Cal
|
||||
def renewRecords(api: dict[str, dict[str, list[str]]], current_ip: str, log: Callable[[str], Any], ttl) -> None:
|
||||
# Updates the records and reates them if they don't exist
|
||||
payload = json.dumps({
|
||||
'items': [{
|
||||
'rrset_type': 'A',
|
||||
'rrset_values': [current_ip],
|
||||
'rrset_ttl': ttl
|
||||
}]
|
||||
'rrset_values': [current_ip],
|
||||
'rrset_ttl': ttl
|
||||
})
|
||||
|
||||
for key, domains in api.items():
|
||||
@ -95,7 +92,7 @@ def renewRecords(api: dict[str, dict[str, list[str]]], current_ip: str, log: Cal
|
||||
for domain, records in domains.items():
|
||||
for record in records:
|
||||
response = requests.put(
|
||||
f"https://api.gandi.net/v5/livedns/domains/{domain}/records/{record}", data=payload, headers=headers)
|
||||
f"https://api.gandi.net/v5/livedns/domains/{domain}/records/{record}/A", data=payload, headers=headers)
|
||||
if response.status_code == 201:
|
||||
log(f"[OK][{domain}][{record}] Renewed with IP '{current_ip}'")
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user