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

Method http_error_auth_reqed

Lib/urllib/request.py:1075–1093  ·  view source on GitHub ↗
(self, auth_header, host, req, headers)

Source from the content-addressed store, hash-verified

1073 self.retried = 0
1074
1075 def http_error_auth_reqed(self, auth_header, host, req, headers):
1076 authreq = headers.get(auth_header, None)
1077 if self.retried > 5:
1078 # Don't fail endlessly - if we failed once, we'll probably
1079 # fail a second time. Hm. Unless the Password Manager is
1080 # prompting for the information. Crap. This isn't great
1081 # but it's better than the current 'repeat until recursion
1082 # depth exceeded' approach <wink>
1083 raise HTTPError(req.full_url, 401, "digest auth failed",
1084 headers, None)
1085 else:
1086 self.retried += 1
1087 if authreq:
1088 scheme = authreq.split()[0]
1089 if scheme.lower() == 'digest':
1090 return self.retry_http_digest_auth(req, authreq)
1091 elif scheme.lower() != 'basic':
1092 raise ValueError("AbstractDigestAuthHandler does not support"
1093 " the following scheme: '%s'" % scheme)
1094
1095 def retry_http_digest_auth(self, req, auth):
1096 token, challenge = auth.split(' ', 1)

Callers

nothing calls this directly

Calls 5

HTTPErrorClass · 0.90
getMethod · 0.45
splitMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected