From: Stefan Schantl Date: Wed, 22 Oct 2014 19:39:09 +0000 (+0200) Subject: Add changeip.com as new provider. X-Git-Tag: 006~7 X-Git-Url: http://git.ipfire.org/?p=oddments%2Fddns.git;a=commitdiff_plain;h=78046ffe2187d91c61d6c2f910249b8a5be71b08 Add changeip.com as new provider. Fixes #10639. --- diff --git a/README b/README index 5944102..6a06f4b 100644 --- a/README +++ b/README @@ -49,6 +49,7 @@ INSTALLATION: SUPPORTED PROVIDERS: all-inkl.com + changeip.com dhs.org dns.lightningwirelabs.com dnspark.com diff --git a/ddns.conf.sample b/ddns.conf.sample index d3ac53f..0048a46 100644 --- a/ddns.conf.sample +++ b/ddns.conf.sample @@ -30,6 +30,11 @@ # secret = XYZ # ttl = 60 +# [test.changeip.com] +# provider = changeip.com +# username = user +# password = pass + # [test.dhs.org] # provider = dhs.org # username = user diff --git a/src/ddns/providers.py b/src/ddns/providers.py index 1e88995..587d5ff 100644 --- a/src/ddns/providers.py +++ b/src/ddns/providers.py @@ -539,6 +539,44 @@ class DDNSProviderBindNsupdate(DDNSProvider): 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"