openapi-core/openapi_core/contrib/requests/responses.py

15 lines
431 B
Python
Raw Normal View History

2020-03-02 16:05:36 +00:00
"""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(
2020-03-25 11:29:53 +00:00
data=response.content,
2020-03-02 16:05:36 +00:00
status_code=response.status_code,
mimetype=mimetype,
)