From 9676af1d2630aad4babe5a2862a403e7b507ad1d Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 4 Mar 2026 11:51:39 +0000 Subject: [PATCH 1/2] Use truststore instead of certifi --- pyproject.toml | 2 +- src/ahttpx/_network.py | 4 ++-- src/httpx/_network.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e708b5d..a611e57 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ classifiers = [ "Topic :: Internet :: WWW/HTTP", ] dependencies = [ - "certifi", + "truststore", ] dynamic = ["version"] diff --git a/src/ahttpx/_network.py b/src/ahttpx/_network.py index 63d7c8f..c50e9ee 100644 --- a/src/ahttpx/_network.py +++ b/src/ahttpx/_network.py @@ -87,8 +87,8 @@ def __init__(self, ssl_ctx: ssl.SSLContext | None = None): self._ssl_ctx = self.create_default_context() if ssl_ctx is None else ssl_ctx def create_default_context(self) -> ssl.SSLContext: - import certifi - return ssl.create_default_context(cafile=certifi.where()) + import truststore + return truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT) async def connect(self, host: str, port: int) -> NetworkStream: """ diff --git a/src/httpx/_network.py b/src/httpx/_network.py index 8410f61..56cc3de 100644 --- a/src/httpx/_network.py +++ b/src/httpx/_network.py @@ -199,8 +199,8 @@ def __init__(self, ssl_ctx: ssl.SSLContext | None = None): self._ssl_ctx = self.create_default_context() if ssl_ctx is None else ssl_ctx def create_default_context(self) -> ssl.SSLContext: - import certifi - return ssl.create_default_context(cafile=certifi.where()) + import truststore + return truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT) def connect(self, host: str, port: int) -> NetworkStream: """ From de68d617203a5969f42e1e6f1f1095792f428710 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 4 Mar 2026 11:59:53 +0000 Subject: [PATCH 2/2] No lazy imports --- src/ahttpx/_network.py | 3 +-- src/httpx/_network.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ahttpx/_network.py b/src/ahttpx/_network.py index c50e9ee..e1f89f5 100644 --- a/src/ahttpx/_network.py +++ b/src/ahttpx/_network.py @@ -3,7 +3,7 @@ import typing import trio -import certifi +import truststore from ._streams import Stream @@ -87,7 +87,6 @@ def __init__(self, ssl_ctx: ssl.SSLContext | None = None): self._ssl_ctx = self.create_default_context() if ssl_ctx is None else ssl_ctx def create_default_context(self) -> ssl.SSLContext: - import truststore return truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT) async def connect(self, host: str, port: int) -> NetworkStream: diff --git a/src/httpx/_network.py b/src/httpx/_network.py index 56cc3de..0554b61 100644 --- a/src/httpx/_network.py +++ b/src/httpx/_network.py @@ -9,6 +9,8 @@ import types import typing +import truststore + from ._streams import Stream @@ -199,7 +201,6 @@ def __init__(self, ssl_ctx: ssl.SSLContext | None = None): self._ssl_ctx = self.create_default_context() if ssl_ctx is None else ssl_ctx def create_default_context(self) -> ssl.SSLContext: - import truststore return truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT) def connect(self, host: str, port: int) -> NetworkStream: