handle_401_warn for when invalid credentials are given
@@ -199,7 +199,7 @@ class MultiDomainBasicAuth(AuthBase):
# Add our new username and password to the request
req = HTTPBasicAuth(username or "", password or "")(resp.request)
- req.register_hook("response", self.handle_401_again)
+ req.register_hook("response", self.handle_401_warn)
# Send our new request
new_resp = resp.connection.send(req, **kwargs)
@@ -207,11 +207,9 @@ class MultiDomainBasicAuth(AuthBase):
return new_resp
- def handle_401_again(self, resp, **kwargs):
+ def handle_401_warn(self, resp, **kwargs):
# warn user that they provided incorrect credentials
- if resp.status_code != 401:
- return resp
-
+ if resp.status_code == 401:
logger.warning('401 Error, Credentials not correct for %s',
resp.request.url)
return resp
