Skip to content
Merged
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
10 changes: 7 additions & 3 deletions elastic_transport/_node/_http_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import re
import ssl
import warnings
from typing import Any, MutableMapping, Optional, Union
from typing import Optional, TypedDict, Union

from .._compat import warn_stacklevel
from .._exceptions import ConnectionError, ConnectionTimeout, SecurityWarning, TlsError
Expand Down Expand Up @@ -55,6 +55,10 @@

# See aio-libs/aiohttp#1769 and #5012
_AIOHTTP_FIXED_HEAD_BUG = _AIOHTTP_SEMVER_VERSION >= (3, 7, 0)

class RequestKwarg(TypedDict, total=False):
ssl: aiohttp.Fingerprint

except ImportError: # pragma: nocover
_AIOHTTP_AVAILABLE = False
_AIOHTTP_META_VERSION = ""
Expand Down Expand Up @@ -170,7 +174,7 @@ async def perform_request( # type: ignore[override]
else:
body_to_send = None

kwargs: MutableMapping[str, Any] = {}
kwargs: RequestKwarg = {}
if self._ssl_assert_fingerprint:
kwargs["ssl"] = aiohttp_fingerprint(self._ssl_assert_fingerprint)

Expand All @@ -182,7 +186,7 @@ async def perform_request( # type: ignore[override]
data=body_to_send,
headers=request_headers,
timeout=aiohttp_timeout,
**kwargs, # type: ignore[arg-type]
**kwargs,
) as response:
if is_head: # We actually called 'GET' so throw away the data.
await response.release()
Expand Down
Loading