Truststore is a Python library that enables certificate verification using native system trust stores on macOS, Windows, and Linux, providing a more secure and consistent approach to SSL/TLS. It is currently at version 0.10.4 and maintains an active release cadence with frequent bug fixes and platform improvements.
pip install truststoreVerified import paths — ran on the pinned version, not inferred.
The most common way to use truststore is by calling `truststore.inject_into_ssl()` early in your application's execution. This globally patches `ssl.SSLContext`, causing libraries like `requests` and `httpx` to automatically use the system's trust store for certificate verification. This example demonstrates making a simple request with `requests` after injection.
Ensure `truststore.inject_into_ssl()` is one of the first lines of executable code in your main script or entry point.
Upgrade to truststore 0.10.4 or higher to resolve the thread-safety bug. If unable to upgrade, avoid using truststore in multi-threaded contexts where `SSLContext` objects are frequently configured.
Ensure your project's `requires_python` is set to `>=3.10` and your environment uses a compatible Python interpreter.
If granular control is needed, you can use `truststore.SSLContext` directly instead of `ssl.SSLContext` for specific connections, or `truststore.extract_from_ssl()` to temporarily revert the global patch.
Update error handling code to catch `ImportError` when `truststore` is not supported on a given platform, instead of `OSError`.
pip install truststore
For Python 3.9, install a compatible older version: `pip install 'truststore<0.10'`. Alternatively, upgrade your Python environment to 3.10 or newer for the latest truststore features.
Add `import truststore; truststore.inject_into_ssl()` at the beginning of your application's entry point, ensuring it runs before any code that needs the patched SSL context.
Only call `truststore.uninstall_from_ssl()` after a successful call to `truststore.inject_into_ssl()`, and ensure it's not called redundantly.
No dependency data recorded yet.