Add entrydns as new provider.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 13 Jul 2014 15:34:41 +0000 (17:34 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Mon, 14 Jul 2014 08:47:53 +0000 (10:47 +0200)
README
ddns.conf.sample
src/ddns/providers.py

diff --git a/README b/README
index 6002c19..8aff221 100644 (file)
--- 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
index cc7f25b..30b85cc 100644 (file)
 # username = user
 # password = pass
 
+# [test.entrydns.net]
+# provider = entrydns.net
+# token = token
+
 # [test.freedns.afraid.org]
 # provider = freedns.afraid.org
 # token = token
index 512d663..a36651e 100644 (file)
@@ -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"