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

Method retry_http_basic_auth

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

Source from the content-addressed store, hash-verified

980 % (scheme,))
981
982 def retry_http_basic_auth(self, host, req, realm):
983 user, pw = self.passwd.find_user_password(realm, host)
984 if pw is not None:
985 raw = "%s:%s" % (user, pw)
986 auth = "Basic " + base64.b64encode(raw.encode()).decode("ascii")
987 if req.get_header(self.auth_header, None) == auth:
988 return None
989 req.add_unredirected_header(self.auth_header, auth)
990 return self.parent.open(req, timeout=req.timeout)
991 else:
992 return None
993
994 def http_request(self, req):
995 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