sphinx-contrib / openapi

OpenAPI (fka Swagger) spec renderer for Sphinx.
https://sphinxcontrib-openapi.readthedocs.io
BSD 2-Clause "Simplified" License
111 stars 80 forks source link

Cannot get external references through HTTP using requests #140

Closed mades797 closed 1 year ago

mades797 commented 1 year ago

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