2525 BaseNode ,
2626 BinaryApiResponse ,
2727 HeadApiResponse ,
28- HttpHeaders ,
2928 NodeConfig ,
3029 NodePool ,
3130 NodeSelector ,
@@ -226,18 +225,6 @@ def __init__(
226225 ):
227226 sniff_callback = default_sniff_callback
228227
229- headers = HttpHeaders ()
230- if headers is not DEFAULT and headers is not None :
231- headers .update (headers )
232- if opaque_id is not DEFAULT and opaque_id is not None : # type: ignore[comparison-overlap]
233- headers ["x-opaque-id" ] = opaque_id
234- headers = resolve_auth_headers (
235- headers ,
236- api_key = api_key ,
237- basic_auth = basic_auth ,
238- bearer_auth = bearer_auth ,
239- )
240-
241228 if _transport is None :
242229 node_configs = client_node_configs (
243230 hosts ,
@@ -309,7 +296,7 @@ def __init__(
309296 ** transport_kwargs ,
310297 )
311298
312- self ._base_client = BaseClient (_transport , headers = headers )
299+ self ._base_client = BaseClient (_transport )
313300
314301 # These are set per-request so are stored separately.
315302 self ._base_client ._request_timeout = request_timeout
@@ -320,7 +307,18 @@ def __init__(
320307 self ._base_client ._retry_on_status = retry_on_status
321308
322309 else :
323- self ._base_client = BaseClient (_transport , headers = headers )
310+ self ._base_client = BaseClient (_transport )
311+
312+ if headers is not DEFAULT and headers is not None :
313+ self ._base_client ._headers .update (headers )
314+ if opaque_id is not DEFAULT and opaque_id is not None : # type: ignore[comparison-overlap]
315+ self ._base_client ._headers ["x-opaque-id" ] = opaque_id
316+ self ._base_client ._headers = resolve_auth_headers (
317+ self ._base_client ._headers ,
318+ api_key = api_key ,
319+ basic_auth = basic_auth ,
320+ bearer_auth = bearer_auth ,
321+ )
324322
325323 # namespaced clients for compatibility with API names
326324 self .async_search = AsyncSearchClient (self ._base_client )
0 commit comments