Skip to content

Commit

Permalink
[Backport 8.15] Fix aiohttp call type: ignore differently (#193)
Browse files Browse the repository at this point in the history
(cherry picked from commit d50788d)

Co-authored-by: Quentin Pradet <quentin.pradet@elastic.co>
  • Loading branch information
github-actions[bot] and pquentin authored Oct 3, 2024
1 parent 3daf810 commit dffac8b
Showing 1 changed file with 7 additions and 3 deletions.
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

0 comments on commit dffac8b

Please sign in to comment.