Registry / auth-security / python-certifi-win32

python-certifi-win32

JSON →
library1.6.1pypypi✓ verified 24d ago

python-certifi-win32 is a Python package that patches the `certifi` module at runtime to include certificates from the Windows certificate store. This allows applications like `requests` (and tools based on it, such as `pip`) to verify TLS/SSL connections to servers whose Certificate Authorities (CAs) are trusted by the Windows operating system. The package is currently at version 1.6.1, but is generally unmaintained and has been superseded by `pip-system-certs`.

pip install python-certifi-win32
INSTALL
IMPORT
SIG · PYTHON-CERTIFI-WIN
P
python-certifi-win32
auth-securitypythonv1.6.1
Install
2.7s avg
Import
Disk
22MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.6.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 21.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.7s · import 0.000s · 22MB
22MB installed
● package 22MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

certifi_win32
import certifi_win32
import certifi_win32

This quickstart demonstrates how `python-certifi-win32` is intended to work. After installation, it transparently patches `certifi` to include Windows system certificates. When libraries like `requests` make HTTPS calls, they automatically leverage this enhanced certificate store for verification, which is particularly useful in enterprise environments that rely on custom root CAs deployed via Windows Group Policy. The example performs a simple `requests.get` to show a successful secure connection. Explicit imports are typically not needed for runtime patching, but are shown commented for advanced use cases like PyInstaller.

import requests import sys import os print(f"Attempting to make a secure request...") try: # In a Windows environment with python-certifi-win32 installed, # this request should implicitly use the combined CA bundle # including Windows system certificates. response = requests.get("https://www.google.com", timeout=10) response.raise_for_status() print(f"Successfully connected to Google (Status: {response.status_code})") print("This indicates that SSL/TLS verification worked, potentially leveraging Windows system certificates.") except requests.exceptions.RequestException as e: print(f"Error making request: {e}") print("If this is on Windows and behind a corporate proxy, python-certifi-win32 aims to resolve such SSL errors by including system CAs.") # Example of how it might be explicitly used for PyInstaller (not part of typical quickstart) # if sys.platform == 'win32': # import certifi_win32 # # This sets an environment variable that 'requests' respects to find the CA bundle. # os.environ['REQUESTS_CA_BUNDLE'] = certifi_win32.wincerts.where() # certifi_win32.generate_pem() # print(f"REQUESTS_CA_BUNDLE set to: {os.environ['REQUESTS_CA_BUNDLE']}")
Debug
Known issues
breakingThe package `python-certifi-win32` is generally unmaintained and has been replaced by `pip-system-certs`. Users are strongly encouraged to migrate to `pip-system-certs` for ongoing support and compatibility, especially with newer Python versions.
fix
Uninstall `python-certifi-win32` and install `pip-system-certs`: `pip uninstall python-certifi-win32 && pip install pip-system-certs`.
affects: All versions
gotchaInstallation can lead to `PermissionError: [WinError 32]` errors when running `pip` or other Python commands. This is often caused by `.pth` files left open or in use.
fix
Locate and delete `python-certifi-win32-init.pth` and `distutils-precedence.pth` files from your Python's `site-packages` directory (e.g., `C:\Users\<username>\AppData\Local\Programs\Python\Python310\Lib\site-packages`). This disables the runtime patching and may require manual certificate handling or migration to `pip-system-certs`.
affects: All versions, particularly on Python 3.10+
breakingVersion 1.4 and later dropped explicit support for Python 2 due to syntax changes (`return` with argument inside generator). While the PyPI metadata might indicate Python 2 compatibility, it is not functional.
fix
Use Python 3.4+ or migrate to `pip-system-certs` which explicitly supports modern Python versions.
affects: 1.4+
gotchaWhen bundling applications with PyInstaller (or similar tools), the automatic runtime patching of `certifi` does not work. Manual intervention is required to integrate Windows certificates.
fix
Before importing `requests` (or other SSL-aware libraries), explicitly `import certifi_win32`, set `os.environ['REQUESTS_CA_BUNDLE'] = certifi_win32.wincerts.where()`, and call `certifi_win32.generate_pem()`.
affects: All versions
gotchaInstalling `python-certifi-win32` as a non-admin user on Windows 10 has been reported to cause runtime environment failures, including `PermissionError` during Python startup or when running `pip`.
fix
Install the package with administrator privileges or, preferably, migrate to `pip-system-certs`.
affects: All versions
Upgrade
Version history
1.6.1latest on PyPI · released Jul 2, 2022
Audit
Dependencies
certifirequiredThis package patches certifi to extend its CA bundle with Windows system certificates.
requestsoptionalOften used in conjunction with this library to enable secure HTTPS connections in corporate or enterprise environments that rely on Windows' trusted CAs.
Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
1
Resources
python-certifi-win32 — pip install python-certifi-win32 · libregistry