add ddns Provider key-systems.net

Message ID 20200107163537.30752-1-christofweniger@gmx.at
State Accepted
Headers
Series add ddns Provider key-systems.net |

Commit Message

Christof Weniger Jan. 7, 2020, 4:35 p.m. UTC
  Hi,

sorry for the long delay. It's the time of the year,  where I think it might be easier to just move in with the childrens doctor instead of daily vists :-(

Michael thank you for your pointers and reviews.


---
 README                |  1 +
 src/ddns/providers.py | 46 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

--
2.17.1
  

Comments

Michael Tremer Jan. 7, 2020, 8:47 p.m. UTC | #1
Hey Christof,

Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>

> On 7 Jan 2020, at 16:35, Christof Weniger <ChristofWeniger@gmx.at> wrote:
> 
> Hi,
> 
> sorry for the long delay. It's the time of the year,  where I think it might be easier to just move in with the childrens doctor instead of daily vists :-(

That doesn’t sound good :(

> Michael thank you for your pointers and reviews.

The patch however does!

There is an extra newline after the class, but I guess we can accept it.

I will leave it for Stefan to merge. 

Thanks.

-Michael

> 
> 
> ---
> README                |  1 +
> src/ddns/providers.py | 46 +++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 47 insertions(+)
> 
> diff --git a/README b/README
> index c75c448..b6decb3 100644
> --- a/README
> +++ b/README
> @@ -72,6 +72,7 @@ SUPPORTED PROVIDERS:
> 	inwx.com|de|at|ch|es
> 	itsdns.de
> 	joker.com
> +	key-systems.net
> 	loopia.se
> 	myonlineportal.net
> 	namecheap.com
> diff --git a/src/ddns/providers.py b/src/ddns/providers.py
> index 661fbcc..666740e 100644
> --- a/src/ddns/providers.py
> +++ b/src/ddns/providers.py
> @@ -1204,6 +1204,52 @@ class DDNSProviderJoker(DDNSProtocolDynDNS2, DDNSProvider):
> 		url = "https://svc.joker.com/nic/update"
> 
> 
> +class DDNSProviderKEYSYSTEMS(DDNSProvider):
> +	handle    = "key-systems.net"
> +	name      = "dynamicdns.key-systems.net"
> +	website   = "https://domaindiscount24.com/"
> +	protocols = ("ipv4",)
> +
> +	# There are only information provided by the domaindiscount24 how to
> +	# perform an update with HTTP APIs
> +	# https://www.domaindiscount24.com/faq/dynamic-dns
> +	# examples: https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
> +	#           https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x
> +
> +	url = "https://dynamicdns.key-systems.net/update.php"
> +	can_remove_records = False
> +
> +	def update_protocol(self, proto):
> +		address = self.get_address(proto)
> +		data = {
> +			"hostname"      : self.hostname,
> +			"password"      : self.password,
> +			"ip"            : address,
> +		}
> +
> +		# 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 "code = 200" in output:
> +			return
> +
> +		# Handle error messages.
> +		if "abuse prevention triggered" in output:
> +			raise DDNSAbuseError
> +		elif "invalid password" in output:
> +			raise DDNSAuthenticationError
> +		elif "Authorization failed" in output:
> +			raise DDNSRequestError(_("Invalid hostname specified"))
> +
> +		# If we got here, some other update error happened.
> +		raise DDNSUpdateError
> +
> +
> +
> class DDNSProviderGoogle(DDNSProtocolDynDNS2, DDNSProvider):
>         handle    = "domains.google.com"
>         name      = "Google Domains"
> --
> 2.17.1
>
  
Stefan Schantl Jan. 23, 2020, 10:54 a.m. UTC | #2
Hello Christof,

thanks for your Patch.

I've merged it and corrected the "extra new line" issue.

Because we currently porting DDNS to python3, I also did a required
change.

Best regards,

-Stefan
> Hey Christof,
> 
> Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
> 
> > On 7 Jan 2020, at 16:35, Christof Weniger <ChristofWeniger@gmx.at>
> > wrote:
> > 
> > Hi,
> > 
> > sorry for the long delay. It's the time of the year,  where I think
> > it might be easier to just move in with the childrens doctor
> > instead of daily vists :-(
> 
> That doesn’t sound good :(
> 
> > Michael thank you for your pointers and reviews.
> 
> The patch however does!
> 
> There is an extra newline after the class, but I guess we can accept
> it.
> 
> I will leave it for Stefan to merge. 
> 
> Thanks.
> 
> -Michael
> 
> > 
> > ---
> > README                |  1 +
> > src/ddns/providers.py | 46
> > +++++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 47 insertions(+)
> > 
> > diff --git a/README b/README
> > index c75c448..b6decb3 100644
> > --- a/README
> > +++ b/README
> > @@ -72,6 +72,7 @@ SUPPORTED PROVIDERS:
> > 	inwx.com|de|at|ch|es
> > 	itsdns.de
> > 	joker.com
> > +	key-systems.net
> > 	loopia.se
> > 	myonlineportal.net
> > 	namecheap.com
> > diff --git a/src/ddns/providers.py b/src/ddns/providers.py
> > index 661fbcc..666740e 100644
> > --- a/src/ddns/providers.py
> > +++ b/src/ddns/providers.py
> > @@ -1204,6 +1204,52 @@ class DDNSProviderJoker(DDNSProtocolDynDNS2,
> > DDNSProvider):
> > 		url = "https://svc.joker.com/nic/update"
> > 
> > 
> > +class DDNSProviderKEYSYSTEMS(DDNSProvider):
> > +	handle    = "key-systems.net"
> > +	name      = "dynamicdns.key-systems.net"
> > +	website   = "https://domaindiscount24.com/"
> > +	protocols = ("ipv4",)
> > +
> > +	# There are only information provided by the domaindiscount24
> > how to
> > +	# perform an update with HTTP APIs
> > +	# https://www.domaindiscount24.com/faq/dynamic-dns
> > +	# examples: 
> > https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
> > +	#           
> > https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x
> > +
> > +	url = "https://dynamicdns.key-systems.net/update.php"
> > +	can_remove_records = False
> > +
> > +	def update_protocol(self, proto):
> > +		address = self.get_address(proto)
> > +		data = {
> > +			"hostname"      : self.hostname,
> > +			"password"      : self.password,
> > +			"ip"            : address,
> > +		}
> > +
> > +		# 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 "code = 200" in output:
> > +			return
> > +
> > +		# Handle error messages.
> > +		if "abuse prevention triggered" in output:
> > +			raise DDNSAbuseError
> > +		elif "invalid password" in output:
> > +			raise DDNSAuthenticationError
> > +		elif "Authorization failed" in output:
> > +			raise DDNSRequestError(_("Invalid hostname
> > specified"))
> > +
> > +		# If we got here, some other update error happened.
> > +		raise DDNSUpdateError
> > +
> > +
> > +
> > class DDNSProviderGoogle(DDNSProtocolDynDNS2, DDNSProvider):
> >         handle    = "domains.google.com"
> >         name      = "Google Domains"
> > --
> > 2.17.1
> >
  

Patch

diff --git a/README b/README
index c75c448..b6decb3 100644
--- a/README
+++ b/README
@@ -72,6 +72,7 @@  SUPPORTED PROVIDERS:
 	inwx.com|de|at|ch|es
 	itsdns.de
 	joker.com
+	key-systems.net
 	loopia.se
 	myonlineportal.net
 	namecheap.com
diff --git a/src/ddns/providers.py b/src/ddns/providers.py
index 661fbcc..666740e 100644
--- a/src/ddns/providers.py
+++ b/src/ddns/providers.py
@@ -1204,6 +1204,52 @@  class DDNSProviderJoker(DDNSProtocolDynDNS2, DDNSProvider):
 		url = "https://svc.joker.com/nic/update"


+class DDNSProviderKEYSYSTEMS(DDNSProvider):
+	handle    = "key-systems.net"
+	name      = "dynamicdns.key-systems.net"
+	website   = "https://domaindiscount24.com/"
+	protocols = ("ipv4",)
+
+	# There are only information provided by the domaindiscount24 how to
+	# perform an update with HTTP APIs
+	# https://www.domaindiscount24.com/faq/dynamic-dns
+	# examples: https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=auto
+	#           https://dynamicdns.key-systems.net/update.php?hostname=hostname&password=password&ip=213.x.x.x&mx=213.x.x.x
+
+	url = "https://dynamicdns.key-systems.net/update.php"
+	can_remove_records = False
+
+	def update_protocol(self, proto):
+		address = self.get_address(proto)
+		data = {
+			"hostname"      : self.hostname,
+			"password"      : self.password,
+			"ip"            : address,
+		}
+
+		# 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 "code = 200" in output:
+			return
+
+		# Handle error messages.
+		if "abuse prevention triggered" in output:
+			raise DDNSAbuseError
+		elif "invalid password" in output:
+			raise DDNSAuthenticationError
+		elif "Authorization failed" in output:
+			raise DDNSRequestError(_("Invalid hostname specified"))
+
+		# If we got here, some other update error happened.
+		raise DDNSUpdateError
+
+
+
 class DDNSProviderGoogle(DDNSProtocolDynDNS2, DDNSProvider):
         handle    = "domains.google.com"
         name      = "Google Domains"