public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Add new provider Servercow
@ 2017-02-10 14:35 Jonatan Schlag
  2017-02-10 14:35 ` [PATCH 2/2] Add servercow.de to Readme Jonatan Schlag
  2017-02-13 13:01 ` [PATCH 1/2] Add new provider Servercow Michael Tremer
  0 siblings, 2 replies; 3+ messages in thread
From: Jonatan Schlag @ 2017-02-10 14:35 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]

Tested-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
---
 src/ddns/providers.py | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/src/ddns/providers.py b/src/ddns/providers.py
index 2c30d42..01d7827 100644
--- a/src/ddns/providers.py
+++ b/src/ddns/providers.py
@@ -1452,6 +1452,41 @@ class DDNSProviderSelfhost(DDNSProtocolDynDNS2, DDNSProvider):
 		return data
 
 
+class DDNSProviderServercow(DDNSProvider):
+	handle    = "servercow.de"
+	name      = "servercow.de"
+	website   = "https://servercow.de/"
+	protocols = ("ipv4", "ipv6")
+
+	url = "https://www.servercow.de/dnsupdate/update.php"
+	can_remove_records = False
+
+	def update_protocol(self, proto):
+		data = {
+			"ipaddr"   : self.get_address(proto),
+			"hostname" : self.hostname,
+			"username" : self.username,
+			"pass"     : self.password,
+		}
+
+		# Send request to provider
+		response = self.send_request(self.url, data=data)
+
+		# Read response
+		output = response.read()
+
+		# Server responds with OK if update was successful
+		if output.startswith("OK"):
+			return
+
+		# Catch any errors
+		elif output.startswith("FAILED - Authentication failed"):
+			raise DDNSAuthenticationError
+
+		# If we got here, some other update error happened
+		raise DDNSUpdateError(output)
+
+
 class DDNSProviderSPDNS(DDNSProtocolDynDNS2, DDNSProvider):
 	handle    = "spdns.org"
 	name      = "SPDYN"
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] Add servercow.de to Readme
  2017-02-10 14:35 [PATCH 1/2] Add new provider Servercow Jonatan Schlag
@ 2017-02-10 14:35 ` Jonatan Schlag
  2017-02-13 13:01 ` [PATCH 1/2] Add new provider Servercow Michael Tremer
  1 sibling, 0 replies; 3+ messages in thread
From: Jonatan Schlag @ 2017-02-10 14:35 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
---
 README | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README b/README
index 40f1e7f..ebb647f 100644
--- a/README
+++ b/README
@@ -77,6 +77,7 @@ SUPPORTED PROVIDERS:
 	regfish.com
 	schokokeks.org
 	selfhost.de
+	servercow.de
 	spdns.org
 	strato.com
 	twodns.de
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] Add new provider Servercow
  2017-02-10 14:35 [PATCH 1/2] Add new provider Servercow Jonatan Schlag
  2017-02-10 14:35 ` [PATCH 2/2] Add servercow.de to Readme Jonatan Schlag
@ 2017-02-13 13:01 ` Michael Tremer
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tremer @ 2017-02-13 13:01 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 1865 bytes --]

Hello Jonatan,

thanks for sending in this patch. I have seen this work already, so I ACK this
patch.

Reviewed-by: Michael Tremer <michael.tremer(a)ipfire.org>

Good work!

Best,
-Michael

On Fri, 2017-02-10 at 15:35 +0100, Jonatan Schlag wrote:
> Tested-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
> Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
> ---
>  src/ddns/providers.py | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/src/ddns/providers.py b/src/ddns/providers.py
> index 2c30d42..01d7827 100644
> --- a/src/ddns/providers.py
> +++ b/src/ddns/providers.py
> @@ -1452,6 +1452,41 @@ class DDNSProviderSelfhost(DDNSProtocolDynDNS2,
> DDNSProvider):
>  		return data
>  
>  
> +class DDNSProviderServercow(DDNSProvider):
> +	handle    = "servercow.de"
> +	name      = "servercow.de"
> +	website   = "https://servercow.de/"
> +	protocols = ("ipv4", "ipv6")
> +
> +	url = "https://www.servercow.de/dnsupdate/update.php"
> +	can_remove_records = False
> +
> +	def update_protocol(self, proto):
> +		data = {
> +			"ipaddr"   : self.get_address(proto),
> +			"hostname" : self.hostname,
> +			"username" : self.username,
> +			"pass"     : self.password,
> +		}
> +
> +		# Send request to provider
> +		response = self.send_request(self.url, data=data)
> +
> +		# Read response
> +		output = response.read()
> +
> +		# Server responds with OK if update was successful
> +		if output.startswith("OK"):
> +			return
> +
> +		# Catch any errors
> +		elif output.startswith("FAILED - Authentication failed"):
> +			raise DDNSAuthenticationError
> +
> +		# If we got here, some other update error happened
> +		raise DDNSUpdateError(output)
> +
> +
>  class DDNSProviderSPDNS(DDNSProtocolDynDNS2, DDNSProvider):
>  	handle    = "spdns.org"
>  	name      = "SPDYN"

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-13 13:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-10 14:35 [PATCH 1/2] Add new provider Servercow Jonatan Schlag
2017-02-10 14:35 ` [PATCH 2/2] Add servercow.de to Readme Jonatan Schlag
2017-02-13 13:01 ` [PATCH 1/2] Add new provider Servercow Michael Tremer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox