From 3b16fdb1433f64122fb3cde2e86e9acf18df430f Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Tue, 17 Jun 2014 19:46:54 +0200 Subject: [PATCH 1/1] Add all-inkl.com as new provider. --- ddns.conf.sample | 5 +++++ src/ddns/__init__.py | 1 + src/ddns/providers.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/ddns.conf.sample b/ddns.conf.sample index 1fb2071..895b537 100644 --- a/ddns.conf.sample +++ b/ddns.conf.sample @@ -15,6 +15,11 @@ # Accounts are its own sections. # These are some examples. +# [test.all-inkl.com] +# provider = all-inkl.com +# username = user +# password = pass + # [test.dhs.org] # provider = dhs.org # username = user diff --git a/src/ddns/__init__.py b/src/ddns/__init__.py index bb9c748..5ed4636 100644 --- a/src/ddns/__init__.py +++ b/src/ddns/__init__.py @@ -91,6 +91,7 @@ class DDNSCore(object): Simply registers all providers. """ for provider in ( + DDNSProviderAllInkl, DDNSProviderDHS, DDNSProviderDNSpark, DDNSProviderDtDNS, diff --git a/src/ddns/providers.py b/src/ddns/providers.py index 85d3a37..f4944be 100644 --- a/src/ddns/providers.py +++ b/src/ddns/providers.py @@ -20,6 +20,7 @@ ############################################################################### import logging +import urllib2 from i18n import _ @@ -167,6 +168,47 @@ class DDNSProvider(object): return self.core.system.get_address(proto) +class DDNSProviderAllInkl(DDNSProvider): + INFO = { + "handle" : "all-inkl.com", + "name" : "All-inkl.com", + "website" : "http://all-inkl.com/", + "protocols" : ["ipv4",] + } + + # There are only information provided by the vendor how to + # perform an update on a FRITZ Box. Grab requried informations + # from the net. + # http://all-inkl.goetze.it/v01/ddns-mit-einfachen-mitteln/ + + url = "http://dyndns.kasserver.com" + + def update(self): + + # There is no additional data required so we directly can + # send our request. + try: + # Send request to the server. + response = self.send_request(self.url, username=self.username, password=self.password) + + # Handle 401 HTTP Header (Authentication Error) + except urllib2.HTTPError, e: + if e.code == 401: + raise DDNSAuthenticationError + + raise + + # Get the full response message. + output = response.read() + + # Handle success messages. + if output.startswith("good") or output.startswith("nochg"): + return + + # If we got here, some other update error happened. + raise DDNSUpdateError + + class DDNSProviderDHS(DDNSProvider): INFO = { "handle" : "dhs.org", -- 2.39.2