certifi
certifi provides Mozilla's carefully curated collection of Root Certificates for validating the trustworthiness of SSL certificates while verifying the identity of TLS hosts. Extracted from the Requests project, it exposes a single public API — certifi.where() — returning the filesystem path to the bundled cacert.pem. The current version is 2026.2.25 (versioned by release date). Releases are issued roughly every 1–3 months, tracking Mozilla's own CA store updates.
Warnings
- breaking Versions <2023.07.22 include compromised 'e-Tugra' root certificates (CVE / GHSA-xqr8-7jwr-rhp7). Any pinned version in that range must be upgraded.
- breaking certifi.old_where() was removed and re-added only as a no-op alias of certifi.where(). Code that relied on it to restore 1024-bit root certificates no longer gets those weak roots.
- gotcha certifi explicitly does NOT support modifying the CA store. Writing custom CAs directly into cacert.pem is overwritten on every package upgrade.
- gotcha On macOS (python.org installer), Python does NOT automatically use the system Keychain. SSL errors like CERTIFICATE_VERIFY_FAILED appear immediately after a fresh install.
- gotcha requests bundles certifi as a dependency and uses it automatically; explicitly passing verify=certifi.where() is redundant in most cases but required when REQUESTS_CA_BUNDLE or SSL_CERT_FILE overrides are set in the environment and you want to force the certifi store.
- gotcha certifi does not read or merge the operating system's CA trust store on any platform. Corporate proxies doing TLS inspection with an internal root CA will cause SSLError even with certifi up to date.
- deprecated Python 2 support was dropped. certifi now requires Python >=3.7 as per its package metadata.
Install
-
pip install certifi -
pip install --upgrade certifi
Imports
- certifi
import certifi certifi.where()
- certifi.where
import certifi path = certifi.where() # returns str path to cacert.pem
Quickstart
import certifi
import requests
import urllib3
import ssl
# 1. Print the path to the bundled CA bundle
print(certifi.where()) # e.g. /path/to/certifi/cacert.pem
# 2. Pass explicitly to requests (requests uses certifi automatically,
# but being explicit avoids surprises when REQUESTS_CA_BUNDLE is set)
response = requests.get("https://httpbin.org/get", verify=certifi.where())
print(response.status_code)
# 3. Pass to urllib3 directly
http = urllib3.PoolManager(ca_certs=certifi.where())
r = http.request("GET", "https://httpbin.org/get")
print(r.status)
# 4. Pass to the stdlib ssl module
ctx = ssl.create_default_context(cafile=certifi.where())
print(ctx)