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

Method http_request

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

Source from the content-addressed store, hash-verified

992 return None
993
994 def http_request(self, req):
995 if (not hasattr(self.passwd, 'is_authenticated') or
996 not self.passwd.is_authenticated(req.full_url)):
997 return req
998
999 if not req.has_header('Authorization'):
1000 user, passwd = self.passwd.find_user_password(None, req.full_url)
1001 credentials = '{0}:{1}'.format(user, passwd).encode()
1002 auth_str = base64.standard_b64encode(credentials).decode()
1003 req.add_unredirected_header('Authorization',
1004 'Basic {}'.format(auth_str.strip()))
1005 return req
1006
1007 def http_response(self, req, response):
1008 if hasattr(self.passwd, 'is_authenticated'):

Callers

nothing calls this directly

Calls 9

hasattrFunction · 0.85
is_authenticatedMethod · 0.80
has_headerMethod · 0.45
find_user_passwordMethod · 0.45
encodeMethod · 0.45
formatMethod · 0.45
decodeMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected