Skip to main content

Verify certificates using OS trust stores. This is useful when your system contains

Project description

Truststore

PyPI CI

Verify certificates using OS trust stores. This is useful when your system contains custom certificate authorities such as when using a corporate proxy or using test certificates. Supports macOS, Windows, and Linux (with OpenSSL).

Installation

Truststore is installed from PyPI with pip:

$ python -m pip install truststore

Truststore requires Python 3.10 or later and supports the following platforms:

User Guide

You can inject truststore into the standard library ssl module so the functionality is used by every library by default. To do so use the truststore.inject_into_ssl() function:

import truststore
truststore.inject_into_ssl()

# Automatically works with urllib3, requests, aiohttp, and more:
import urllib3
http = urllib3.PoolManager()
resp = http.request("GET", "https://example.com")

import aiohttp
http = aiohttp.ClientSession()
resp = await http.request("GET", "https://example.com")

import requests
resp = requests.get("https://example.com")

If you'd like finer-grained control you can create your own truststore.SSLContext instance and use it anywhere you'd use an ssl.SSLContext:

import ssl
import truststore

ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)

import urllib3
http = urllib3.PoolManager(ssl_context=ctx)
resp = http.request("GET", "https://example.com")

You can read more in the user guide in the documentation.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

truststore-0.6.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

truststore-0.6.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file truststore-0.6.0.tar.gz.

File metadata

  • Download URL: truststore-0.6.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for truststore-0.6.0.tar.gz
Algorithm Hash digest
SHA256 abd5599b794ab9ec875d801266d61f075033350ea8f2e37dd51cbacc993e55d5
MD5 55643e4c093c97b5420178cc65060baf
BLAKE2b-256 27efd79f08d08bc4a62948fcca58ec5ab4d8379ec259ed55b40c6148f7badcb6

See more details on using hashes here.

File details

Details for the file truststore-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: truststore-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for truststore-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13d51e69cd4bf088e2184b937a44b9bf975251c5a48e1182b9a7f604b96bec09
MD5 b912be118e7882959e541341ddb2e2bf
BLAKE2b-256 d5438f33a0965a80f71dbb34290957d39f1571108ddccdc136ec0112a8ea140b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page