ProviderDDNSS: Fix unhandled exception on update

Message ID 20200525160545.3816-1-stefan.schantl@ipfire.org
State Accepted
Commit 7d0956d14ff8d823551ccd47ccf1492c9da9aac9
Headers
Series ProviderDDNSS: Fix unhandled exception on update |

Commit Message

Stefan Schantl May 25, 2020, 4:05 p.m. UTC
  In python > 3.3 the getheader() attribute is not longer part of the
urllib.response response.info() object. It is part of response object
and so directly can be accessed.

Fixes #12328

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 src/ddns/providers.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
  

Comments

Michael Tremer May 26, 2020, 10:11 a.m. UTC | #1
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>

Did you send this to any of the people affected by the problem to test it?

-Michael

> On 25 May 2020, at 17:05, Stefan Schantl <stefan.schantl@ipfire.org> wrote:
> 
> In python > 3.3 the getheader() attribute is not longer part of the
> urllib.response response.info() object. It is part of response object
> and so directly can be accessed.
> 
> Fixes #12328
> 
> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
> ---
> src/ddns/providers.py | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/ddns/providers.py b/src/ddns/providers.py
> index f1fed22..46d8a67 100644
> --- a/src/ddns/providers.py
> +++ b/src/ddns/providers.py
> @@ -642,10 +642,8 @@ class DDNSProviderDDNSS(DDNSProvider):
> 		response = self.send_request(self.url, data=data)
> 
> 		# This provider sends the response code as part of the header.
> -		header = response.info()
> -
> 		# Get status information from the header.
> -		output = header.getheader('ddnss-response')
> +		output = response.getheader('ddnss-response')
> 
> 		# Handle success messages.
> 		if output == "good" or output == "nochg":
> -- 
> 2.26.1
>
  

Patch

diff --git a/src/ddns/providers.py b/src/ddns/providers.py
index f1fed22..46d8a67 100644
--- a/src/ddns/providers.py
+++ b/src/ddns/providers.py
@@ -642,10 +642,8 @@  class DDNSProviderDDNSS(DDNSProvider):
 		response = self.send_request(self.url, data=data)
 
 		# This provider sends the response code as part of the header.
-		header = response.info()
-
 		# Get status information from the header.
-		output = header.getheader('ddnss-response')
+		output = response.getheader('ddnss-response')
 
 		# Handle success messages.
 		if output == "good" or output == "nochg":