Type stubs for the certifi package, which provides Mozilla's curated collection of root certificates for validating SSL certificates and verifying TLS host identities in Python applications.
npx @tessl/cli install tessl/pypi-types-certifi@2020.4.0Type stubs for the certifi package, which provides Mozilla's carefully curated collection of root certificates for validating SSL certificates and verifying TLS host identities in Python applications. These type stubs enable static type checking tools like mypy to provide better type safety when working with certifi's API.
pip install types-certifiimport certifiOr import the specific function:
from certifi import whereimport certifi
# Get the path to the CA certificate bundle
cert_path = certifi.where()
print(cert_path) # /path/to/cacert.pem
# Use with requests or other HTTP libraries
import requests
response = requests.get('https://httpbin.org/get', verify=certifi.where())Returns the filesystem path to the Mozilla CA certificate bundle included with the certifi package. This function provides a reliable way to access trusted root certificates for SSL/TLS validation without depending on system certificate stores.
def where() -> str:
"""
Return the path to the Mozilla CA certificate bundle.
Returns:
str: Absolute filesystem path to the cacert.pem bundle file
Example:
>>> import certifi
>>> certifi.where()
'/path/to/site-packages/certifi/cacert.pem'
"""The certificate bundle is typically used with HTTP libraries for SSL verification:
import certifi
import requests
# Use certifi with requests
response = requests.get('https://example.com', verify=certifi.where())
# Or with urllib3
import urllib3
http = urllib3.PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where())The types-certifi package provides type information for the certifi library, which consists of:
where() function that returns the absolute path to the certificate bundleThe certifi package serves as a foundation for secure HTTPS communications in Python applications by providing a consistent, cross-platform source of trusted root certificates that doesn't rely on system-specific certificate stores.