-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
When instantiating Elasticsearch or AsyncElasticsearch, it is possible to pass a parameter named http_auth.
If node_class is requests and http_auth is a subclass of requests.auth.AuthBase, http_auth is passed to client_node_configs which stores it in the node config (extra["requests.session.auth"]) (https://github.com/elastic/elasticsearch-py/blob/main/elasticsearch/_sync/client/utils.py#L130).
The requests node retrieves this parameter from config and passes it to the requests session
(https://github.com/elastic/elastic-transport-python/blob/main/elastic_transport/_node/_http_requests.py#L147).
This behavior was introduced by #1944 (elasticsearch-py) and elastic/elastic-transport-python#48 (elastic-transport-python).
requests is not the only http client to support a custom authentication class. It can also be done by httpx (auth parameter of Client or AsyncClient (https://www.python-httpx.org/api/#asyncclient)).
Would you accept a PR that adds the support for http_auth when using the httpx node class?