From 023cf5380f900d3a21b6155bd963caf6d10edf61 Mon Sep 17 00:00:00 2001 From: Seth Michael Larson Date: Tue, 20 Jul 2021 11:58:32 -0500 Subject: [PATCH] [7.x] Document 'UnsupportedProductError' --- docs/sphinx/exceptions.rst | 1 + docs/sphinx/transports.rst | 16 ++++++++-------- elasticsearch/__init__.py | 2 ++ elasticsearch/__init__.pyi | 1 + 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/sphinx/exceptions.rst b/docs/sphinx/exceptions.rst index 03bb60e1..2ec9c6ce 100644 --- a/docs/sphinx/exceptions.rst +++ b/docs/sphinx/exceptions.rst @@ -23,3 +23,4 @@ Exceptions .. autoclass:: RequestError(TransportError) .. autoclass:: AuthenticationException(TransportError) .. autoclass:: AuthorizationException(TransportError) +.. autoclass:: UnsupportedProductError diff --git a/docs/sphinx/transports.rst b/docs/sphinx/transports.rst index bac6b44b..6daa15db 100644 --- a/docs/sphinx/transports.rst +++ b/docs/sphinx/transports.rst @@ -26,21 +26,21 @@ Product check on first request Starting in v7.14.0 the client performs a required product check before the first API call is executed. This product check allows the client to -establish that it's communicating with a valid Elasticsearch cluster. +establish that it's communicating with a supported Elasticsearch cluster. The product check requires a single HTTP request to the ``info`` API. In most cases this request will succeed quickly and then no further product check HTTP requests will be sent. The product check will verify that the ``X-Elastic-Product: Elasticsearch`` -HTTP header is being sent or if the ``info`` API response has proper values -of ``tagline`` and ``version.build_flavor``. +HTTP header is being sent or if the ``info`` API indicates a supported +distribution of Elasticsearch. -If the client detects that it's not connected to Elasticsearch the -``NotElasticsearchError`` exception will be raised. In previous versions -of Elasticsearch the ``info`` API required additional permissions so -if an authentication or authorization error is raised during the -product check then an ``ElasticsearchWarning`` is raised and the client +If the client detects that it's not connected to a supported distribution of +Elasticsearch the ``UnsupportedProductError`` exception will be raised. +In previous versions of Elasticsearch the ``info`` API required additional +permissions so if an authentication or authorization error is raised during +the product check then an ``ElasticsearchWarning`` is raised and the client proceeds normally. .. py:module:: elasticsearch.connection diff --git a/elasticsearch/__init__.py b/elasticsearch/__init__.py index 05f16398..ea05b5b2 100644 --- a/elasticsearch/__init__.py +++ b/elasticsearch/__init__.py @@ -51,6 +51,7 @@ from .exceptions import ( SerializationError, SSLError, TransportError, + UnsupportedProductError, ) from .serializer import JSONSerializer from .transport import Transport @@ -81,6 +82,7 @@ __all__ = [ "ConnectionTimeout", "AuthenticationException", "AuthorizationException", + "UnsupportedProductError", "ElasticsearchWarning", "ElasticsearchDeprecationWarning", ] diff --git a/elasticsearch/__init__.pyi b/elasticsearch/__init__.pyi index 20a60aa2..373f623c 100644 --- a/elasticsearch/__init__.pyi +++ b/elasticsearch/__init__.pyi @@ -40,6 +40,7 @@ from .exceptions import RequestError as RequestError from .exceptions import SerializationError as SerializationError from .exceptions import SSLError as SSLError from .exceptions import TransportError as TransportError +from .exceptions import UnsupportedProductError as UnsupportedProductError from .serializer import JSONSerializer as JSONSerializer from .transport import Transport as Transport