skillfed

requests-pkcs12

Add PKCS#12 support to the requests library in a clean way, without monkey patching or temporary files

requests-pkcs12 v1.27 1.3M downloads/30d#4,149 on PyPI128
Permissive license ISC AGING released

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-pkcs12

uv

uv add requests-pkcs12

poetry

poetry add requests-pkcs12

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: ISC License (ISCL)Programming Language :: Python :: 3Topic :: Software Development :: Libraries

Tags

pkcs12 certificate requestsclient certificate authentication pythonrequests ssl certificatep12 certificate supporthttps client cert pythonrequests custom ssl contextcertificate-based authentication
tls-client-authcertificate-handling

More Libraries packages