From: Stefan Schantl Date: Sun, 13 Jul 2014 15:34:41 +0000 (+0200) Subject: Add entrydns as new provider. X-Git-Tag: 003~5 X-Git-Url: http://git.ipfire.org/?p=ddns.git;a=commitdiff_plain;h=ab4e352e95a4b5f3761d0097c55d672352e3ebe8 Add entrydns as new provider. --- diff --git a/README b/README index 6002c19..8aff221 100644 --- a/README +++ b/README @@ -57,6 +57,7 @@ SUPPORTED PROVIDERS: dynu.com easydns.com enom.com + entrydns.net freedns.afraid.org namecheap.com no-ip.com diff --git a/ddns.conf.sample b/ddns.conf.sample index cc7f25b..30b85cc 100644 --- a/ddns.conf.sample +++ b/ddns.conf.sample @@ -63,6 +63,10 @@ # username = user # password = pass +# [test.entrydns.net] +# provider = entrydns.net +# token = token + # [test.freedns.afraid.org] # provider = freedns.afraid.org # token = token diff --git a/src/ddns/providers.py b/src/ddns/providers.py index 512d663..a36651e 100644 --- a/src/ddns/providers.py +++ b/src/ddns/providers.py @@ -574,6 +574,46 @@ class DDNSProviderEnomCom(DDNSResponseParserXML, DDNSProvider): raise DDNSUpdateError +class DDNSProviderEntryDNS(DDNSProvider): + handle = "entrydns.net" + name = "EntryDNS" + website = "http://entrydns.net/" + protocols = ("ipv4",) + + # Some very tiny details about their so called "Simple API" can be found + # here: https://entrydns.net/help + url = "https://entrydns.net/records/modify" + + def update(self): + data = { + "ip" : self.get_address("ipv4") + } + + # Add auth token to the update url. + url = "%s/%s" % (self.url, self.token) + + # Send update to the server. + try: + response = self.send_request(url, method="PUT", data=data) + + # Handle error codes + except urllib2.HTTPError, e: + if e.code == 404: + raise DDNSAuthenticationError + + elif e.code == 422: + raise DDNSRequestError(_("An invalid IP address was submitted")) + + raise + + # Handle success messages. + if response.code == 200: + return + + # If we got here, some other update error happened. + raise DDNSUpdateError + + class DDNSProviderFreeDNSAfraidOrg(DDNSProvider): handle = "freedns.afraid.org" name = "freedns.afraid.org"