Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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.

3.2.0 (2025-11-20)
++++++++++++++++++
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = [
{name = "Gregory Oschwald", email = "goschwald@maxmind.com"},
]
dependencies = [
"aiohttp>=3.6.2,<4.0.0",
"aiohttp>=3.14.0,<4.0.0",
"email_validator>=2.0.0,<3.0.0",
"geoip2>=5.2.0,<6.0.0",
"requests>=2.24.0,<3.0.0",
Expand Down
10 changes: 8 additions & 2 deletions src/minfraud/webservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,14 @@ async def _do_request(
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),
)

Expand Down
11 changes: 11 additions & 0 deletions tests/test_webservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,17 @@ def test_200(self) -> None:
self.assertEqual("004", model.ip_address.traits.mobile_network_code)
self.assertEqual("ANONYMOUS_IP", model.ip_address.risk_reasons[0].code)

def test_authorization_header(self) -> None:
# Credentials must be sent via the Authorization header rather than the
# deprecated aiohttp BasicAuth / auth= parameter. The expected value is
# base64("42:abcdef123456").
self.create_success()
request, _ = self.httpserver.log[-1]
self.assertEqual(
"Basic NDI6YWJjZGVmMTIzNDU2",
request.headers.get("Authorization"),
)

def test_200_on_request_with_nones(self) -> None:
model = self.create_success(
request={
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading