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

Method _parse_realm

Lib/urllib/request.py:937–956  ·  view source on GitHub ↗
(self, header)

Source from the content-addressed store, hash-verified

935 self.add_password = self.passwd.add_password
936
937 def _parse_realm(self, header):
938 # parse WWW-Authenticate header: accept multiple challenges per header
939 found_challenge = False
940 for mo in AbstractBasicAuthHandler.rx.finditer(header):
941 scheme, quote, realm = mo.groups()
942 if quote not in ['"', "'"]:
943 import warnings
944 warnings.warn("Basic Auth Realm was unquoted",
945 UserWarning, 3)
946
947 yield (scheme, realm)
948
949 found_challenge = True
950
951 if not found_challenge:
952 if header:
953 scheme = header.split()[0]
954 else:
955 scheme = ''
956 yield (scheme, None)
957
958 def http_error_auth_reqed(self, authreq, host, req, headers):
959 # host may be an authority (without userinfo) or a URL with an

Callers 1

http_error_auth_reqedMethod · 0.95

Calls 3

groupsMethod · 0.45
warnMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected