Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion elasticsearch/_sync/client/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.

import base64
import re
import warnings
from typing import (
Expand Down Expand Up @@ -168,13 +169,23 @@ def _sniffed_node_callback(
def sniff_callback(
transport: Transport, sniff_options: SniffOptions
) -> List[NodeConfig]:
# Dynamically resolve authentication headers based on the client's configuration.
auth_headers = resolve_auth_headers(
headers=None,
http_auth=transport.http_auth,
api_key=transport.api_key,
basic_auth=transport.basic_auth,
bearer_auth=transport.bearer_auth,
)

for _ in transport.node_pool.all():
try:
meta, node_infos = transport.perform_request(
"GET",
"/_nodes/_all/http",
headers={
"accept": "application/vnd.elasticsearch+json; compatible-with=8"
**auth_headers, # Include the resolved authentication headers
"accept": "application/vnd.elasticsearch+json; compatible-with=8",
},
request_timeout=(
sniff_options.sniff_timeout
Expand Down