sphinx-contrib/openapi

Cannot get external references through HTTP using requests

Closed this issue · 0 comments

OpenApiRefResolver passes the requests.Response object to the yaml loader instead of a string or bytes. This raises an AttributeError when yaml module calls the non-existing read() method on the Response object.

In openapi/utils.py

if scheme in [u"http", u"https"] and self._requests:
    response = self._requests.get(uri)  # This is a requests.Response object
    result = yaml.safe_load(response)  # Raises an AttributeError