MCPcopy Index your code
hub / github.com/prometheus/client_python / _get_escaping

Function _get_escaping

prometheus_client/exposition.py:386–408  ·  view source on GitHub ↗

Return the escaping scheme from the Accept header. If no escaping scheme is specified or the scheme is not one of the allowed strings, defaults to UNDERSCORES.

(accept_header: List[str])

Source from the content-addressed store, hash-verified

384
385
386def _get_escaping(accept_header: List[str]) -> str:
387 """Return the escaping scheme from the Accept header.
388
389 If no escaping scheme is specified or the scheme is not one of the allowed
390 strings, defaults to UNDERSCORES."""
391
392 for tok in accept_header:
393 if '=' not in tok:
394 continue
395 key, value = tok.strip().split('=', 1)
396 if key != 'escaping':
397 continue
398 if value == openmetrics.ALLOWUTF8:
399 return openmetrics.ALLOWUTF8
400 elif value == openmetrics.UNDERSCORES:
401 return openmetrics.UNDERSCORES
402 elif value == openmetrics.DOTS:
403 return openmetrics.DOTS
404 elif value == openmetrics.VALUES:
405 return openmetrics.VALUES
406 else:
407 return openmetrics.UNDERSCORES
408 return openmetrics.UNDERSCORES
409
410
411def gzip_accepted(accept_encoding_header: str) -> bool:

Callers 1

choose_encoderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected