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

Method http_request

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

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