ProvenPin Install

Stacks

httpx recipes

13 tested httpx integration recipes with FastAPI, Pydantic Settings, Pydantic, slowapi. Exact pinned versions and a last-passed receipt, last run 2026-10-15.

passed5/5python

FastAPI config via pydantic-settings as a cached dependency

Load config from env vars with pydantic-settings, inject it into FastAPI routes through a cached dependency, and test it offline with monkeypatch and dependency_overrides.

fastapi@0.143.1pydantic-settings@2.16.0httpx@0.28.1
last passed 2026-10-15 13:14 UTC
passed5/5python

FastAPI endpoint with Pydantic v2 discriminated unions and Annotated validators

Accept a tagged union of payment methods with Field(discriminator), add Annotated validators, and test the exact 422 error shapes offline with TestClient.

fastapi@0.143.1pydantic@2.14.1httpx@0.28.1
last passed 2026-10-15 13:17 UTC
passed5/5python

FastAPI endpoints rate limited with slowapi, tested with TestClient

Add per-route and per-API-key rate limits to FastAPI with slowapi, then test 429 behavior offline with TestClient and the in-memory store.

fastapi@0.143.1slowapi@0.1.10httpx@0.28.1
last passed 2026-10-15 13:14 UTC
passed6/6python

FastAPI Jinja2 full pages vs HTMX partials via HX-Request

Serve a full HTML page to normal browsers and a bare HTML fragment to HTMX requests, chosen by the HX-Request header, with Vary set for caches. Tested offline with the sync TestClient.

fastapi@0.143.1jinja2@3.1.6httpx@0.28.1
last passed 2026-10-15 13:14 UTC
passed6/6python

FastAPI lifespan state tested with httpx ASGITransport and asgi-lifespan

A FastAPI app that opens a SQLite connection in its lifespan, then test it offline through httpx ASGITransport, with asgi-lifespan running startup and shutdown.

fastapi@0.143.1httpx@0.28.1asgi-lifespan@2.1.0
last passed 2026-10-15 13:14 UTC
passed6/6python

FastAPI login with argon2-cffi hashing and rehash checks

A form-based FastAPI login that verifies argon2id hashes without leaking which users exist, and transparently upgrades outdated hashes on successful login, tested offline with TestClient and an in-memory store.

fastapi@0.143.1argon2-cffi@25.1.0httpx@0.28.1
last passed 2026-10-15 13:14 UTC
passed5/5python

FastAPI request ids in structlog contextvars, tested with capture_logs

Pure ASGI middleware binds a request id into structlog contextvars, echoes it in an X-Request-ID header, and is tested offline with TestClient and structlog.testing.capture_logs.

fastapi@0.143.1structlog@26.1.0httpx@0.28.1
last passed 2026-10-15 13:18 UTC
passed4/4python

FastAPI with async SQLAlchemy 2 on aiosqlite, tested offline with per-test in-memory DBs

A FastAPI app using AsyncSession and async_sessionmaker on aiosqlite, tested with httpx.AsyncClient over ASGITransport, overriding the session dependency with a fresh in-memory database for each test.

fastapi@0.143.1sqlalchemy@2.1.4aiosqlite@0.22.1
last passed 2026-10-15 13:14 UTC
passed5/5python

httpx + tenacity async retries honoring Retry-After, tested with respx

Wrap async httpx calls in tenacity AsyncRetrying that retries 429 and 5xx, honors Retry-After, and patches the wait to zero in tests with respx mocks.

httpx@0.28.1tenacity@9.2.1respx@0.23.1
last passed 2026-10-15 13:18 UTC
passed3/3python

httpx async API client + respx mocks

A typed async API client on httpx with retries on 5xx and Pydantic parsing, tested offline with respx route mocks.

httpx@0.28.1respx@0.23.1pydantic@2.14.1
last passed 2026-10-15 13:15 UTC
passed4/4python

httpx client + tenacity retries with backoff, tested with respx

Retry transient HTTP failures (5xx, 429, timeouts) with tenacity around an httpx client, honoring a max attempt count, tested offline with respx.

httpx@0.28.1tenacity@9.2.1respx@0.23.1
last passed 2026-10-15 13:15 UTC
passed4/4python

httpx OAuth2 client-credentials client with cached tokens and Link pagination

A sync httpx client that fetches and caches an OAuth2 client-credentials token, refreshes it on 401, and follows Link-header pagination, tested offline with respx routes.

httpx@0.28.1respx@0.23.1pytest@9.1.1
last passed 2026-10-15 13:15 UTC
passed6/6python

Typed httpx client parsing into pydantic v2 models, tested with respx

An async httpx client that retries 5xx and transport errors, validates responses into pydantic v2 models, and is tested offline with respx route mocks.

httpx@0.28.1pydantic@2.14.1respx@0.23.1
last passed 2026-10-15 13:15 UTC

Used together with httpx

FastAPIPydantic SettingsPydanticslowapijinja2asgi-lifespanargon2-cffipython-multipartstructlogSQLAlchemyaiosqlitepytest-asynciotenacityrespx