From dd708023eafa4d9f88b0e0d253ad15ac4ebbe24c Mon Sep 17 00:00:00 2001 From: Marcus Ingelborn <3088117-MrIngelborn@users.noreply.gitlab.com> Date: Fri, 23 Aug 2024 17:42:20 +0200 Subject: [PATCH] Add function for dyndns --- domeneshop/client.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/domeneshop/client.py b/domeneshop/client.py index e9fc6ac..a9ccbbd 100644 --- a/domeneshop/client.py +++ b/domeneshop/client.py @@ -166,6 +166,22 @@ def delete_record(self, domain_id: int, record_id: int) -> None: """ self._request("DELETE", "/domains/{0}/dns/{1}".format(domain_id, record_id)) + # Dynamic DNS (DDNS) + + def update_dyndns(self, domain_name: str, ip_address=None) -> None: + """ + Update the DNS record for a given domain, or raises an error. + + :param domain_name: The fully qualified domain(s) (FQDN) to be updated + :param ip_address: The new ip address to set. If not provided the IP of the client making the API request will be used. + """ + if ip_address is not None: + ip_param = "&myip={0}".format(ip_address) + else: + ip_param = "" + self._requst("GET", "/dyndns/update?hostname={0}{1}".format(domain_name, ip_param) + + # Forwards def get_forwards(self, domain_id: int) -> List[dict]: