httpx-pki

PKCS#12 client-certificate (mTLS) sessions for httpx2 and httpx.

httpx-pki gives you an httpx client that presents a client certificate, loaded from wherever your certificate actually lives — a .p12/.pfx bundle, a PEM file, a separate key and cert, the Windows certificate store, or the macOS keychain — without hand-rolling an ssl.SSLContext or writing the private key to a temporary file.

from httpx_pki import PKIClient

with PKIClient("client.p12", password="secret") as client:
    r = client.get("https://mtls.example.com/")

Backend

Since 0.8, httpx-pki depends on httpx2 and PKIClient subclasses httpx2.Client. The original httpx remains fully supported as a fallback — see Backends: httpx2 and httpx.

Where to start

Quickstart

Install, load a certificate, make a request.

Quickstart
User guide

Every source format, identity selection, server trust, rotation.

User guide
API reference

Every public class, function, exception, and warning.

Reference
How it works

What happens between your bundle and the TLS handshake.

How it works