requests-pkcs12
Add PKCS#12 support to the requests library in a clean way, without monkey patching or temporary files
What it is and what it does
requests-pkcs12 extends the requests library to handle PKCS#12 (p12/pfx) certificate files for mutual TLS authentication. Instead of monkey patching or writing unencrypted temporary files, it creates a custom TransportAdapter that provides a custom SSLContext, integrating cleanly into requests' design. You can use it as a drop-in replacement for one-off requests or mount it to a session for repeated authenticated calls.
The package depends on cryptography for certificate handling and requests itself. It supports both file-based and in-memory certificate data, accepts optional password protection, and allows SSL protocol version configuration. The authors position it as a transitional solution until requests adds native PKCS#12 support.
Use it for:
- Authenticate to APIs that require client certificates in PKCS#12 format without managing temporary unencrypted files.
- Build a requests Session with persistent PKCS#12-based authentication for repeated calls to the same endpoint.
- Migrate legacy systems using p12 certificates to Python without rewriting certificate handling infrastructure.
- Test HTTPS endpoints that enforce mutual TLS with client certificate validation during CI/CD pipelines.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds PKCS#12 certificate support to the requests library without monkey patching, enabling client certificate authentication over HTTPS.
Yes, if you need PKCS#12 support for requests. The implementation is clean, dependencies are minimal, and the license is permissive. The aging maintenance status (341 days since last release) is a minor concern but not a blocker—the package is stable and the repository remains active. No known vulnerabilities. Install if client certificate authentication is a requirement; skip if you can use PEM certificates directly.
Install
requests-pkcs12 on PyPI
pip
pip install requests-pkcs12uv
uv add requests-pkcs12poetry
poetry add requests-pkcs12Installing requests-pkcs12
Before you install
Low friction install with only two runtime dependencies (cryptography and requests). Maintenance is aging—last release was 341 days ago—but the repository remains active and the package is marked Production/Stable.
License in practice
ISC license is permissive and places minimal restrictions on use or redistribution, making it suitable for most commercial and open-source projects.
Quickstart
pip install requests-pkcs12
from requests_pkcs12 import get
r = get('https://example.com/test', pkcs12_filename='clientcert.p12', pkcs12_password='correcthorsebatterystaple')
Requires Python 3.7 or later; cryptography and requests must be installed as runtime dependencies.
Verify before relying
- Whether the package is actively maintained or in maintenance-only mode given the 341-day gap since last release.
- Performance characteristics when handling large or many PKCS#12 certificates in high-throughput scenarios.
Package facts
| License | ISC (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — cryptography, requests |
| Maintenance | aging — 341 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,260,579/month — #4,149 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: requests_pkcs12-1.27-py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
python-certifi-win32Patches certifi at runtime to include…
permissive · top 15,000 on PyPI
requests-fileRequests-File adds file:// URL support to the…
permissive · top 1,000 on PyPI
secure-smtplibProvides secure SMTP subclasses with TLS/SSL…
unclear · top 15,000 on PyPI
django-sslserverProvides an SSL-enabled development server for…
permissive · top 15,000 on PyPI
ndg-httpsclientProvides enhanced HTTPS support for Python's…
permissive · top 5,000 on PyPI
truststoreTruststore exposes native system certificate…
permissive · top 1,000 on PyPI
pip-system-certsAutomatically configures Python to use the…
permissive · top 5,000 on PyPI
wincertstoreAccesses Windows system certificate stores (CA…
permissive · top 15,000 on PyPI
asn1cryptoA pure Python library for parsing and…
permissive · top 1,000 on PyPI
pyjksPyJKS loads and manipulates Java KeyStore…
permissive · top 5,000 on PyPI