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

Function get_lexer_for_response

httpx/_main.py:103–113  ·  view source on GitHub ↗
(response: Response)

Source from the content-addressed store, hash-verified

101
102
103def get_lexer_for_response(response: Response) -> str:
104 content_type = response.headers.get("Content-Type")
105 if content_type is not None:
106 mime_type, _, _ = content_type.partition(";")
107 try:
108 return typing.cast(
109 str, pygments.lexers.get_lexer_for_mimetype(mime_type.strip()).name
110 )
111 except pygments.util.ClassNotFound: # pragma: no cover
112 pass
113 return "" # pragma: no cover
114
115
116def format_request_headers(request: httpcore.Request, http2: bool = False) -> str:

Callers 1

print_responseFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected