morpheus.utils.http_utils.HttpParseResponse
- class HttpParseResponse(status_code, content_type, body, on_complete_callback=None)[source]
Bases:
NamedTuple
A tuple consisting of the HTTP status code, mime type to be used for the Content-Type header, the body of the response and an optional callback function to be invoked once the response is completed.
The values for
status_code
andcontent_type
are strings rather thanhttp.HTTPStatus
andMimeTypes
because these are intended to be consumed directly by the C++ implementation ofmorpheus.common.HttpServer
. Instead these enums should be used to constructHttpParseResponse
instances:>>> http_parse_response = HttpParseResponse(status_code=HTTPStatus.OK.value, ... content_type=MimeTypes.TEXT.value, ... body="OK", ... on_complete_callback=None) >>>
- Attributes
- body
- content_type
- on_complete_callback
- status_code
Alias for field number 2
Alias for field number 1
Alias for field number 3
Alias for field number 0
Methods
count
(value, /)Return number of occurrences of value. index
(value[, start, stop])Return first index of value. - body: str
Alias for field number 2
- content_type: str
Alias for field number 1
- count(value, /)
Return number of occurrences of value.
- index(value, start=0, stop=sys.maxsize, /)
Return first index of value.
Raises ValueError if the value is not present.
- status_code: int
Alias for field number 0