]> git.ipfire.org Git - oddments/ddns.git/commitdiff
Add changeip.com as new provider.
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 22 Oct 2014 19:39:09 +0000 (21:39 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Wed, 22 Oct 2014 19:40:56 +0000 (21:40 +0200)
Fixes #10639.

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

diff --git a/README b/README
index 59441021ca1c5b4568d0701e077413aa313629c9..6a06f4b132c179559a5f1d353828a533e91d7e79 100644 (file)
--- a/README
+++ b/README
@@ -49,6 +49,7 @@ INSTALLATION:
 
 SUPPORTED PROVIDERS:
        all-inkl.com
 
 SUPPORTED PROVIDERS:
        all-inkl.com
+       changeip.com
        dhs.org
        dns.lightningwirelabs.com
        dnspark.com
        dhs.org
        dns.lightningwirelabs.com
        dnspark.com
index d3ac53fa7e91fa043a835f70637ea2b27105dab1..0048a46747c614ec6fb470359864036d4d9a8a04 100644 (file)
 # secret = XYZ
 # ttl = 60
 
 # secret = XYZ
 # ttl = 60
 
+# [test.changeip.com]
+# provider = changeip.com
+# username = user
+# password = pass
+
 # [test.dhs.org]
 # provider = dhs.org
 # username = user
 # [test.dhs.org]
 # provider = dhs.org
 # username = user
index 1e88995962d8343288a582084d3012833f6ee355..587d5fff24fe9025b6bb4e7bc0f5ff192ecb23bd 100644 (file)
@@ -539,6 +539,44 @@ class DDNSProviderBindNsupdate(DDNSProvider):
                return "\n".join(scriptlet)
 
 
                return "\n".join(scriptlet)
 
 
+class DDNSProviderChangeIP(DDNSProvider):
+       handle    = "changeip.com"
+       name      = "ChangeIP.com"
+       website   = "https://changeip.com"
+       protocols = ("ipv4",)
+
+       # Detailed information about the update api can be found here.
+       # http://www.changeip.com/accounts/knowledgebase.php?action=displayarticle&id=34
+
+       url = "https://nic.changeip.com/nic/update"
+       can_remove_records = False
+
+       def update_protocol(self, proto):
+               data = {
+                       "hostname" : self.hostname,
+                       "myip"     : self.get_address(proto),
+               }
+
+               # Send update to the server.
+               try:
+                       response = self.send_request(self.url, username=self.username, password=self.password,
+                               data=data)
+
+               # Handle error codes.
+               except urllib2.HTTPError, e:
+                       if e.code == 422:
+                               raise DDNSRequestError(_("Domain not found."))
+
+                       raise
+
+               # Handle success message.
+               if response.code == 200:
+                       return
+
+               # If we got here, some other update error happened.
+               raise DDNSUpdateError(_("Server response: %s") % output)
+
+
 class DDNSProviderDHS(DDNSProvider):
        handle    = "dhs.org"
        name      = "DHS International"
 class DDNSProviderDHS(DDNSProvider):
        handle    = "dhs.org"
        name      = "DHS International"