skills/httpx/SKILL.md
HTTPX client patterns for Python services, scripts, and applications. Covers client lifetime, sync and async usage, timeouts, streaming, auth, retries, error handling, and testing with mock transports. Load when working with outbound HTTP in Python.
npx skillsauth add oornnery/.agents httpxInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use when work is primarily outbound HTTP in Python.
Use this skill for:
Pair with:
python for general Python conventions and project workflowsecurity when requests touch auth, secrets, SSRF risk, or untrusted URLsquality when flaky integrations or retry behavior need tighter guardsreferences/clients.md -- client lifetime, shared config, auth, limits, transports, and async boundariesreferences/requests-and-streaming.md -- request shapes, file transfer, pagination, and streaming patternsreferences/testing.md -- MockTransport, dependency injection, fake responses, and integration test boundariesassets/client.py -- typed crudcrud.com client example with shared config and explicit CRUD methodsassets/testing.py -- test of same crudcrud.com adapter using MockTransport over real network callsKeep this file focused on defaults and guardrails.
httpx.Client or httpx.AsyncClient over top-level helpers when making more than one requestbase_url for service clients -- paths stay short, consistentClient, async code with AsyncClientraise_for_status() when non-2xx should fail fastfrom collections.abc import AsyncIterator
import httpx
def build_client() -> httpx.Client:
return httpx.Client(
base_url="https://api.example.com",
timeout=httpx.Timeout(10.0, connect=3.0),
headers={"User-Agent": "myapp/1.0"},
follow_redirects=True,
)
async def build_async_client() -> AsyncIterator[httpx.AsyncClient]:
async with httpx.AsyncClient(
base_url="https://api.example.com",
timeout=httpx.Timeout(10.0, connect=3.0),
) as client:
yield client
httpx.Timeout(...) when connect, read, or write behavior mattersFor deeper client setup patterns, load references/clients.md.
httpx.TimeoutException for timeoutshttpx.HTTPStatusError when server responded with failing statushttpx.RequestError for network and transport failuresraise_for_status() inside low-level helpers if callers need to branch on specific status codeshttpx.get or httpx.post all over tests; inject clients or transports insteaddevelopment
--- name: verification description: Discover and run project validation gates: format, lint, typecheck, LSP diagnostics, tests, build, static security checks, dependency audits, and RTK output handling. Use before claiming work is complete, when fixing broken checks, or when setting up a validation plan. --- # Verification Use this skill to prove changes with the strongest practical checks the repo already supports. ## Discovery Order 1. Read task aliases: `package.json`, `pyproject.toml`, `
tools
Build, review, or validate standalone Python scripts run with uv inline metadata. Use for one-file automation, operational scripts, script dependencies, shebangs, idempotency, safety, representative runs, and promoting scripts to packages.
development
Build, review, or validate Python packages and libraries where public API stability, packaging metadata, imports, examples, changelogs, build output, and compatibility matter.
tools
Build, review, or validate Python command-line applications and terminal tools. Use for argparse, Typer, Rich, Textual-adjacent CLI UX, stdout/stderr contracts, exit codes, automation-friendly flags, help output, and CLI tests.