1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

handle_401_warn for when invalid credentials are given

This commit is contained in:
Kevin R Patterson 2018-08-17 08:25:53 -05:00
parent 4e0c433c37
commit b7222f3d26

View file

@ -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,13 +207,11 @@ 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
logger.warning('401 Error, Credentials not correct for %s',
resp.request.url)
if resp.status_code == 401:
logger.warning('401 Error, Credentials not correct for %s',
resp.request.url)
return resp
def parse_credentials(self, netloc):