]> git.ipfire.org Git - ddns.git/commitdiff
Add zzzz.io as new provider.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 7 Sep 2014 12:28:00 +0000 (14:28 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 7 Sep 2014 13:20:15 +0000 (15:20 +0200)
Only added support for IPv4 because of #10608. Filed a new bug for
adding the IPv6 support as #10612 when the locking issue has been solved.

Fixes #10584.

README
ddns.conf.sample
src/ddns/providers.py

diff --git a/README b/README
index 32765ff73929496f2e1ee3a7eb1cdf0042975351..fe6893e8789480c7f1318024bf23703b7c2f8d41 100644 (file)
--- a/README
+++ b/README
@@ -74,5 +74,6 @@ SUPPORTED PROVIDERS:
        udmedia.de
        variomedia.de
        zoneedit.com
+       zzzz.io
 
 Also supports DNS updates via the ISC BIND nsupdate utility.
index cf4d6a2ef44b8e547e4f8e20126469679357f9e5..6108934e04d518ac37466c46899e0a96367e7359 100644 (file)
 # provider = zoneedit.com
 # username = user
 # password = pass
-# proto = ipv4 OR ipv6 
+# proto = ipv4 OR ipv6
+
+# [test.zzzz.io]
+# token = token 
index a57dc8496c32d0f282e7cf4d5a133bb7cdf610d5..a5385a9c6b1bb25c12d11dd5950d0aac74bff917 100644 (file)
@@ -1152,3 +1152,49 @@ class DDNSProviderZoneedit(DDNSProtocolDynDNS2, DDNSProvider):
 
                # If we got here, some other update error happened.
                raise DDNSUpdateError
+
+
+class DDNSProviderZZZZ(DDNSProvider):
+       handle    = "zzzz.io"
+       name      = "zzzz"
+       website   = "https://zzzz.io"
+       protocols = ("ipv4",)
+
+       # Detailed information about the update request can be found here:
+       # https://zzzz.io/faq/
+
+       # Details about the possible response codes have been provided in the bugtracker:
+       # https://bugzilla.ipfire.org/show_bug.cgi?id=10584#c2
+
+       url = "https://zzzz.io/api/v1/update"
+
+       def update(self):
+               data = {
+                       "ip"    : self.get_address("ipv4"),
+                       "token" : self.token,
+               }
+
+               # zzzz uses the host from the full hostname as part
+               # of the update url.
+               host, domain = self.hostname.split(".", 1)
+
+               # Add host value to the update url.
+               url = "%s/%s" % (self.url, host)
+
+               # Send update to the server.
+               try:
+                       response = self.send_request(url, data=data)
+
+               # Handle error codes.
+               except urllib2.HTTPError, e:
+                       if e.code == 404:
+                               raise DDNSRequestError(_("Invalid hostname specified."))
+
+                       raise
+
+               # Handle success messages.
+               if response.code == 200:
+                       return
+
+               # If we got here, some other update error happened.
+               raise DDNSUpdateError