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)
| 910 | |
| 911 | |
| 912 | def 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 |
nothing calls this directly
no test coverage detected