MCPcopy
hub / github.com/encode/httpx / _get_header_value

Method _get_header_value

httpx/_auth.py:311–327  ·  httpx/_auth.py::DigestAuth._get_header_value
(self, header_fields: dict[str, bytes])

Source from the content-addressed store, hash-verified

309 return hashlib.sha1(s).hexdigest()[:16].encode()
310
311 def _get_header_value(self, header_fields: dict[str, bytes]) -> str:
312 NON_QUOTED_FIELDS = (class="st">"algorithm", class="st">"qop", class="st">"nc")
313 QUOTED_TEMPLATE = &class="cm">#x27;{}=class="st">"{}"'
314 NON_QUOTED_TEMPLATE = class="st">"{}={}"
315
316 header_value = class="st">""
317 for i, (field, value) in enumerate(header_fields.items()):
318 if i > 0:
319 header_value += class="st">", "
320 template = (
321 QUOTED_TEMPLATE
322 if field not in NON_QUOTED_FIELDS
323 else NON_QUOTED_TEMPLATE
324 )
325 header_value += template.format(field, to_str(value))
326
327 return header_value
328
329 def _resolve_qop(self, qop: bytes | None, request: Request) -> bytes | None:
330 if qop is None:

Callers 1

_build_auth_headerMethod · 0.95

Calls 2

to_strFunction · 0.85
itemsMethod · 0.45

Tested by

no test coverage detected