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

Method retry_http_basic_auth

Lib/urllib/request.py:984–994  ·  view source on GitHub ↗
(self, host, req, realm)

Source from the content-addressed store, hash-verified

982 % (scheme,))
983
984 def retry_http_basic_auth(self, host, req, realm):
985 user, pw = self.passwd.find_user_password(realm, host)
986 if pw is not None:
987 raw = "%s:%s" % (user, pw)
988 auth = "Basic " + base64.b64encode(raw.encode()).decode("ascii")
989 if req.get_header(self.auth_header, None) == auth:
990 return None
991 req.add_unredirected_header(self.auth_header, auth)
992 return self.parent.open(req, timeout=req.timeout)
993 else:
994 return None
995
996 def http_request(self, req):
997 if (not hasattr(self.passwd, 'is_authenticated') or

Callers 1

http_error_auth_reqedMethod · 0.95

Calls 6

find_user_passwordMethod · 0.45
decodeMethod · 0.45
encodeMethod · 0.45
get_headerMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected