datalad_next.utils.parse_www_authenticate
- datalad_next.utils.parse_www_authenticate(hdr: str) dict[source]
Parse HTTP www-authenticate header
This helper uses
requestsutilities to parse thewww-authenticateheader as represented in arequests.Responseinstance. The header may contain any number of challenge specifications.The implementation follows RFC7235, where a challenge parameters set is specified as: either a comma-separated list of parameters, or a single sequence of characters capable of holding base64-encoded information, and parameters are name=value pairs, where the name token is matched case-insensitively, and each parameter name MUST only occur once per challenge.
- Returns:
Keys are casefolded challenge labels (e.g., 'basic', 'digest'). Values are:
None(no parameter),str(a token68), ordict(name/value mapping of challenge parameters)- Return type:
dict