tornado-openapi3/tornado_openapi3/responses.py

14 lines
427 B
Python
Raw Normal View History

from tornado.httpclient import HTTPResponse
2024-10-18 21:04:45 +00:00
from werkzeug.datastructures import Headers
2020-11-26 05:05:02 +00:00
2024-10-18 21:04:45 +00:00
class TornadoOpenAPIResponse:
def __init__(self, response: HTTPResponse) -> None:
self.status_code = response.code
self.headers = Headers(response.headers.get_all())
self.content_type = response.headers.get("Content-Type", "text/html")
self.data = response.body
2020-11-26 05:05:02 +00:00
2021-02-26 20:34:54 +00:00
2024-10-18 21:04:45 +00:00
__all__ = ["TornadoOpenAPIResponse"]