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

Class MockHTTPHandlerCheckAuth

Lib/test/test_urllib2.py:540–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

538
539
540class MockHTTPHandlerCheckAuth(urllib.request.BaseHandler):
541 # useful for testing auth
542 # sends supplied code response
543 # checks if auth header is specified in request
544 def __init__(self, code):
545 self.code = code
546 self.has_auth_header = False
547
548 def reset(self):
549 self.has_auth_header = False
550
551 def http_open(self, req):
552 if req.has_header('Authorization'):
553 self.has_auth_header = True
554 name = http.client.responses[self.code]
555 return MockResponse(self.code, name, MockFile(), "", req.get_full_url())
556
557
558

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…