From 86ced0afcab6336bab18a90ceb2635621c4ac219 Mon Sep 17 00:00:00 2001 From: Matthew Crowson Date: Tue, 12 Nov 2019 13:23:55 -0500 Subject: [PATCH 1/2] fall back to basic auth if digest returns 401 and try again --- rets/session.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rets/session.py b/rets/session.py index a919750..6ccb29b 100644 --- a/rets/session.py +++ b/rets/session.py @@ -479,7 +479,12 @@ def _request(self, capability, options=None, stream=False): if response.status_code in [400, 401]: if capability == "Login": - m = "Could not log into the RETS server with the provided credentials." + if self.http_authentication == 'digest': + # Fall back to base64 encoding auth method and try again + self.http_authentication = 'basic' + self.client.auth = HTTPBasicAuth(self.username, self.password) + return self._request(capability, options, stream) + m = "Could not log into the RETS server with the provided credentials in basic or digest." else: m = "The RETS server returned a 401 status code. You must be logged in to make this request." raise NotLoggedIn(m) From 19f8e002b32ca3e45d4507d545d0d3b10700e4f3 Mon Sep 17 00:00:00 2001 From: Matthew Crowson Date: Tue, 12 Nov 2019 13:25:34 -0500 Subject: [PATCH 2/2] version bump --- CHANGELOG.md | 4 ++++ rets/__init__.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe23c61..34de0ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # RETS Changelog +## 0.4.11 + +* Falls back to basic auth if digest returns 401 response on login + ## 0.4.10 * Handles wildcard lookup_names for Standard XML responses. diff --git a/rets/__init__.py b/rets/__init__.py index 10c6f28..bfc81d1 100644 --- a/rets/__init__.py +++ b/rets/__init__.py @@ -2,7 +2,7 @@ from .exceptions import RETSException __title__ = "rets" -__version__ = "0.4.10" +__version__ = "0.4.11" __author__ = "REfindly" __license__ = "MIT" __copyright__ = "Copyright 2019 REfindly"