0
# types-certifi
1
2
Type 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.
3
4
## Package Information
5
6
- **Package Name**: types-certifi
7
- **Package Type**: pypi (Type stubs)
8
- **Language**: Python
9
- **Installation**: `pip install types-certifi`
10
- **Target Package**: certifi (SSL certificate validation library)
11
12
## Core Imports
13
14
```python
15
import certifi
16
```
17
18
Or import the specific function:
19
20
```python
21
from certifi import where
22
```
23
24
## Basic Usage
25
26
```python
27
import certifi
28
29
# Get the path to the CA certificate bundle
30
cert_path = certifi.where()
31
print(cert_path) # /path/to/cacert.pem
32
33
# Use with requests or other HTTP libraries
34
import requests
35
response = requests.get('https://httpbin.org/get', verify=certifi.where())
36
```
37
38
## Capabilities
39
40
### Certificate Bundle Location
41
42
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.
43
44
```python { .api }
45
def where() -> str:
46
"""
47
Return the path to the Mozilla CA certificate bundle.
48
49
Returns:
50
str: Absolute filesystem path to the cacert.pem bundle file
51
52
Example:
53
>>> import certifi
54
>>> certifi.where()
55
'/path/to/site-packages/certifi/cacert.pem'
56
"""
57
```
58
59
The certificate bundle is typically used with HTTP libraries for SSL verification:
60
61
```python
62
import certifi
63
import requests
64
65
# Use certifi with requests
66
response = requests.get('https://example.com', verify=certifi.where())
67
68
# Or with urllib3
69
import urllib3
70
http = urllib3.PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where())
71
```
72
73
## Architecture
74
75
The types-certifi package provides type information for the certifi library, which consists of:
76
77
- **Certificate Bundle**: Mozilla's curated collection of root certificates stored as a PEM file
78
- **Location Function**: Single `where()` function that returns the absolute path to the certificate bundle
79
- **Type Safety**: Static type annotations enabling better IDE support and static analysis
80
81
The 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.