]> git.ipfire.org Git - ddns.git/blobdiff - src/ddns/providers.py
Add empty lines between api documentation and the update url.
[ddns.git] / src / ddns / providers.py
index a023b1e0c9e7464090b296ed3fc35e0e8f66078f..6945423690517603484b0ceab53dfba593ab0ec6 100644 (file)
@@ -139,11 +139,11 @@ class DDNSProvider(object):
                """
                return self.core.system.send_request(*args, **kwargs)
 
-       def get_address(self, proto):
+       def get_address(self, proto, default=None):
                """
                        Proxy method to get the current IP address.
                """
-               return self.core.system.get_address(proto)
+               return self.core.system.get_address(proto) or default
 
 
 class DDNSProviderAllInkl(DDNSProvider):
@@ -183,6 +183,7 @@ class DDNSProviderDHS(DDNSProvider):
 
        # No information about the used update api provided on webpage,
        # grabed from source code of ez-ipudate.
+
        url = "http://members.dhs.org/nic/hosts"
 
        def update(self):
@@ -214,6 +215,7 @@ class DDNSProviderDNSpark(DDNSProvider):
 
        # Informations to the used api can be found here:
        # https://dnspark.zendesk.com/entries/31229348-Dynamic-DNS-API-Documentation
+
        url = "https://control.dnspark.com/api/dynamic/update.php"
 
        def update(self):
@@ -261,6 +263,7 @@ class DDNSProviderDtDNS(DDNSProvider):
 
        # Information about the format of the HTTPS request is to be found
        # http://www.dtdns.com/dtsite/updatespec
+
        url = "https://www.dtdns.com/api/autodns.cfm"
 
        def update(self):
@@ -315,6 +318,7 @@ class DDNSProviderDynDNS(DDNSProvider):
        # Information about the format of the request is to be found
        # http://http://dyn.com/support/developers/api/perform-update/
        # http://dyn.com/support/developers/api/return-codes/
+
        url = "https://members.dyndns.org/nic/update"
 
        def _prepare_request_data(self):
@@ -427,35 +431,27 @@ class DDNSProviderFreeDNSAfraidOrg(DDNSProvider):
                elif "is an invalid IP address" in output:
                        raise DDNSRequestError(_("Invalid IP address has been sent."))
 
+               # If we got here, some other update error happened.
+               raise DDNSUpdateError
+
 
 class DDNSProviderLightningWireLabs(DDNSProvider):
        handle    = "dns.lightningwirelabs.com"
-       name      = "Lightning Wire Labs"
+       name      = "Lightning Wire Labs DNS Service"
        website   = "http://dns.lightningwirelabs.com/"
 
        # Information about the format of the HTTPS request is to be found
        # https://dns.lightningwirelabs.com/knowledge-base/api/ddns
+
        url = "https://dns.lightningwirelabs.com/update"
 
        def update(self):
                data =  {
                        "hostname" : self.hostname,
+                       "address6" : self.get_address("ipv6", "-"),
+                       "address4" : self.get_address("ipv4", "-"),
                }
 
-               # Check if we update an IPv6 address.
-               address6 = self.get_address("ipv6")
-               if address6:
-                       data["address6"] = address6
-
-               # Check if we update an IPv4 address.
-               address4 = self.get_address("ipv4")
-               if address4:
-                       data["address4"] = address4
-
-               # Raise an error if none address is given.
-               if not data.has_key("address6") and not data.has_key("address4"):
-                       raise DDNSConfigurationError
-
                # Check if a token has been set.
                if self.token:
                        data["token"] = self.token