From: Stefan Schantl Date: Thu, 28 Aug 2014 19:29:59 +0000 (+0200) Subject: Add dyns.cx|net as new provider. X-Git-Tag: 005~20^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a197d1a6e02345440071c6eac59f17ea609d8e72;p=ddns.git Add dyns.cx|net as new provider. --- diff --git a/README b/README index fb7a8ff..32765ff 100644 --- a/README +++ b/README @@ -55,6 +55,7 @@ SUPPORTED PROVIDERS: domopoli.de dtdns.com dyndns.org + dyns.cx|net dynu.com easydns.com enom.com diff --git a/ddns.conf.sample b/ddns.conf.sample index 2a9642f..e2f61ea 100644 --- a/ddns.conf.sample +++ b/ddns.conf.sample @@ -49,6 +49,11 @@ # username = user # password = pass +# [text.dyns.net] +# provider = dyns.net +# username = user +# password = pass + # [test.dynu.com] # provider = dynu.com # username = user diff --git a/src/ddns/providers.py b/src/ddns/providers.py index 00a3855..2ffc35d 100644 --- a/src/ddns/providers.py +++ b/src/ddns/providers.py @@ -556,6 +556,50 @@ class DDNSProviderDomopoli(DDNSProtocolDynDNS2, DDNSProvider): url = "http://dyndns.domopoli.de/nic/update" +class DDNSProviderDynsNet(DDNSProvider): + handle = "dyns.net" + name = "DyNS" + website = "http://www.dyns.net/" + protocols = ("ipv4",) + + # There is very detailed informatio about how to send the update request and + # the possible response codes. (Currently we are using the v1.1 proto) + # http://www.dyns.net/documentation/technical/protocol/ + + url = "http://www.dyns.net/postscript011.php" + + def update(self): + data = { + "ip" : self.get_address("ipv4"), + "host" : self.hostname, + "username" : self.username, + "password" : self.password, + } + + # Send update to the server. + response = self.send_request(self.url, data=data) + + # Get the full response message. + output = response.read() + + # Handle success messages. + if output.startswith("200"): + return + + # Handle error codes. + if output.startswith("400"): + raise DDNSRequestError(_("Malformed request has been sent.")) + elif output.startswith("401"): + raise DDNSAuthenticationError + elif output.startswith("402"): + raise DDNSRequestError(_("Too frequent update requests have been sent.")) + elif output.startswith("403"): + raise DDNSInternalServerError + + # If we got here, some other update error happened. + raise DDNSUpdateError(_("Server response: %s") % output) + + class DDNSProviderEnomCom(DDNSResponseParserXML, DDNSProvider): handle = "enom.com" name = "eNom Inc."