MCPcopy Index your code
hub / github.com/RustPython/RustPython / http_error_auth_reqed

Method http_error_auth_reqed

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

Source from the content-addressed store, hash-verified

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