From 7e546117f951aa9afda4ae032f83caa40d513aff Mon Sep 17 00:00:00 2001 From: Filip Janowski Date: Wed, 5 May 2021 13:11:51 +0200 Subject: [PATCH 1/2] fix handling unauthorized --- rwslib/__init__.py | 2 +- rwslib/tests/test_rwslib.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rwslib/__init__.py b/rwslib/__init__.py index f51717e..4c14e28 100644 --- a/rwslib/__init__.py +++ b/rwslib/__init__.py @@ -147,7 +147,7 @@ def send_request(self, request_object, timeout=None, retries=1, **kwargs): if r.text == "Authorization Header not provided": raise AuthorizationException(r.text) - if "

HTTP Error 401.0 - Unauthorized

" in r.text: + if "HTTP Error 401.0 - Unauthorized" in r.text: raise RWSException("Unauthorized.", r.text) # Check if the content_type is text/xml. Use startswith diff --git a/rwslib/tests/test_rwslib.py b/rwslib/tests/test_rwslib.py index b291bfc..c66d1e6 100644 --- a/rwslib/tests/test_rwslib.py +++ b/rwslib/tests/test_rwslib.py @@ -270,7 +270,7 @@ def test_401_error_error_response_no_header(self): def test_401_error_error_response_unauthorized(self): """Parse the IIS Response Error structure""" - text = b"

HTTP Error 401.0 - Unauthorized

" + text = b"

HTTP Error 401.0 - Unauthorized

" httpretty.register_uri( httpretty.POST, From 74603fff86f53278b38f60bfe70faa9043c5d671 Mon Sep 17 00:00:00 2001 From: Filip Janowski Date: Thu, 6 May 2021 12:53:40 +0200 Subject: [PATCH 2/2] bump version, add author --- AUTHORS.rst | 1 + rwslib/__init__.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 1fc1eb8..fdf9eac 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -9,3 +9,4 @@ Authors - Oli Quinet - Daniel Smoczyk - Bastien Gerard +- Filip Janowski diff --git a/rwslib/__init__.py b/rwslib/__init__.py index 4c14e28..d5b4031 100644 --- a/rwslib/__init__.py +++ b/rwslib/__init__.py @@ -3,7 +3,7 @@ __title__ = "rwslib" __author__ = "Ian Sparks (isparks@trialgrid.com)" __maintainer__ = "Geoff Low (glow@mdsol.com)" -__version__ = "1.2.7" +__version__ = "1.2.8" __license__ = "MIT" __copyright__ = "Copyright 2021 Medidata Solutions Inc"