MCPcopy Index your code
hub / github.com/python/cpython / http_error_auth_reqed

Method http_error_auth_reqed

Lib/urllib/request.py:958–982  ·  view source on GitHub ↗
(self, authreq, host, req, headers)

Source from the content-addressed store, hash-verified

956 yield (scheme, None)
957
958 def http_error_auth_reqed(self, authreq, host, req, headers):
959 # host may be an authority (without userinfo) or a URL with an
960 # authority
961 headers = headers.get_all(authreq)
962 if not headers:
963 # no header found
964 return
965
966 unsupported = None
967 for header in headers:
968 for scheme, realm in self._parse_realm(header):
969 if scheme.lower() != 'basic':
970 unsupported = scheme
971 continue
972
973 if realm is not None:
974 # Use the first matching Basic challenge.
975 # Ignore following challenges even if they use the Basic
976 # scheme.
977 return self.retry_http_basic_auth(host, req, realm)
978
979 if unsupported is not None:
980 raise ValueError("AbstractBasicAuthHandler does not "
981 "support the following scheme: %r"
982 % (scheme,))
983
984 def retry_http_basic_auth(self, host, req, realm):
985 user, pw = self.passwd.find_user_password(realm, host)

Callers 4

http_error_401Method · 0.45
http_error_407Method · 0.45
http_error_401Method · 0.45
http_error_407Method · 0.45

Calls 4

_parse_realmMethod · 0.95
retry_http_basic_authMethod · 0.95
get_allMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected