MCPcopy Create free account
hub / github.com/EasyIME/PIME / parse_response_start_line

Function parse_response_start_line

python/python3/tornado/httputil.py:912–924  ·  view source on GitHub ↗

Returns a (version, code, reason) tuple for an HTTP 1.x response line. The response is a `collections.namedtuple`. >>> parse_response_start_line("HTTP/1.1 200 OK") ResponseStartLine(version='HTTP/1.1', code=200, reason='OK')

(line: str)

Source from the content-addressed store, hash-verified

910
911
912def parse_response_start_line(line: str) -> ResponseStartLine:
913 """Returns a (version, code, reason) tuple for an HTTP 1.x response line.
914
915 The response is a `collections.namedtuple`.
916
917 >>> parse_response_start_line("HTTP/1.1 200 OK")
918 ResponseStartLine(version='HTTP/1.1', code=200, reason='OK')
919 """
920 line = native_str(line)
921 match = _http_response_line_re.match(line)
922 if not match:
923 raise HTTPInputError("Error parsing response start line")
924 return ResponseStartLine(match.group(1), int(match.group(2)), match.group(3))
925
926
927# _parseparam and _parse_header are copied and modified from python2.7's cgi.py

Callers

nothing calls this directly

Calls 2

HTTPInputErrorClass · 0.85
matchMethod · 0.45

Tested by

no test coverage detected