diff --git a/HISTORY.rst b/HISTORY.rst index 47c0617..bc99679 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -10,6 +10,10 @@ History * The version is now retrieved from package metadata at runtime using ``importlib.metadata``. This reduces the chance of version inconsistencies during releases. +* The async client now builds its ``Authorization`` header with + ``aiohttp.encode_basic_auth()`` instead of the ``aiohttp.BasicAuth`` / + ``auth=`` parameter, which are deprecated as of aiohttp 3.14.0. As a result, + the minimum required ``aiohttp`` version is now 3.14.0. 5.2.0 (2025-11-20) ++++++++++++++++++ diff --git a/src/geoip2/webservice.py b/src/geoip2/webservice.py index 55899f1..924854d 100644 --- a/src/geoip2/webservice.py +++ b/src/geoip2/webservice.py @@ -354,8 +354,14 @@ async def insights(self, ip_address: IPAddress = "me") -> Insights: async def _session(self) -> aiohttp.ClientSession: if not hasattr(self, "_existing_session"): self._existing_session = aiohttp.ClientSession( - auth=aiohttp.BasicAuth(self._account_id, self._license_key), - headers={"Accept": "application/json", "User-Agent": _AIOHTTP_UA}, + headers={ + "Accept": "application/json", + "Authorization": aiohttp.encode_basic_auth( + self._account_id, + self._license_key, + ), + "User-Agent": _AIOHTTP_UA, + }, timeout=aiohttp.ClientTimeout(total=self._timeout), )