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
11 changes: 11 additions & 0 deletions elastic_transport/_node/_http_httpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,22 @@ def __init__(self, config: NodeConfig):
elif config.client_cert:
ssl_context.load_cert_chain(config.client_cert)

# Httpx supports setting 'auth' via _extras['requests.session.auth'] = ...
# The naming is weird but it enables compatibility with the existing
# 'requests.session.auth' parameter
try:
httpx_auth: Optional[httpx.Auth] = config._extras.pop(
"requests.session.auth", None
)
except AttributeError:
httpx_auth = None

self.client = httpx.AsyncClient(
base_url=f"{config.scheme}://{config.host}:{config.port}",
limits=httpx.Limits(max_connections=config.connections_per_node),
verify=ssl_context or False,
timeout=config.request_timeout,
auth=httpx_auth,
)

async def perform_request( # type: ignore[override]
Expand Down
Loading