openapi-core/openapi_core/contrib/requests/responses.py
2020-03-25 12:29:53 +01:00

14 lines
431 B
Python

"""OpenAPI core contrib requests responses module"""
from openapi_core.validation.response.datatypes import OpenAPIResponse
class RequestsOpenAPIResponseFactory(object):
@classmethod
def create(cls, response):
mimetype = response.headers.get('Content-Type')
return OpenAPIResponse(
data=response.content,
status_code=response.status_code,
mimetype=mimetype,
)