Closed bbullard916 closed 1 week ago
Hey @bbullard916, thanks for opening this issue. A few things to note here:
response.meta.status
. I opened https://github.com/elastic/elastic-transport-python/pull/175 to document it. The idea then is that "Return type" in elasticsearch-py API docs will link to those docs.exceptions.ApiResponse
is not an exception, it's exceptions.ApiError
. And we already document that you can reach status_code
in that case: https://elasticsearch-py.readthedocs.io/en/v8.14.0/exceptions.htmlDoes that help?
Thanks #1 will take care of the customers concern. He had problems trying to originally find an answer. Thanks for adding that.
I have not managed to get Sphinx, our documentation system, to link to the transport docs yet.
Closing as it is documented in https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/config.html#_ignoring_status_codes at least.
Please update documentation to explain that in order the response code HTTP status code directly, you can do so only by catching the
ApiResponse
exception, which is raised when the API call is not successful. TheApiResponse
exception contains the response object, which includes the status code.Link to update information https://elasticsearch-py.readthedocs.io/en/v8.14.0/exceptions.html.
Example: