dns/ddclient: style sweep

This commit is contained in:
Franco Fichtner 2026-01-26 10:47:47 +01:00
parent 9810e4b1d7
commit 7c4f3c7e4a

View file

@ -54,13 +54,13 @@ class Hostinger(BaseAccount):
if super().execute():
# IPv4/IPv6
recordType = "AAAA" if str(self.current_address).find(':') > 1 else "A"
# Validate TTL
ttl = int(self.settings.get('ttl', 300)) if (60 <= int(self.settings.get('ttl', 300)) <= 86400) else 300
# Use bearer authentication
url = "https://developers.hostinger.com/api/dns/v1/zones/" + self.settings.get('zone')
# Build the zone update payload
payload = {
"overwrite": True,
@ -77,13 +77,13 @@ class Hostinger(BaseAccount):
}
]
}
headers = {
'authorization': "Bearer " + self.settings.get('password'),
'content-type': "application/json",
'User-Agent': 'OPNsense-dyndns'
}
# Send IP address update
req = requests.request("PUT", url, data=json.dumps(payload), headers=headers)
if 200 <= req.status_code < 300:
@ -103,4 +103,4 @@ class Hostinger(BaseAccount):
)
)
return False
return False