---
name: "httpx-async-http-client"
description: "Make asynchronous HTTP requests with HTTP/2 support, connection pooling, and connection timeouts."
metadata:
  author: "Encode"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "async http request httpx"
  - "configure httpx connection pool"
  - "stream large file httpx"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# HTTPX Modern Asynchronous & Synchronous HTTP Client

Implements HTTPX: httpx.AsyncClient, connection pooling (limits), custom timeouts (httpx.Timeout), streaming large downloads, request/response interceptors (event hooks), and mocking in unit tests with respx.

## When to Invoke
Invoke this skill whenever you need to:
- async http request httpx
- configure httpx connection pool
- stream large file httpx

## Execution SOP & Rules
1. Initialize client: async with httpx.AsyncClient(timeout=10.0, http2=True) as client: ...
2. Execute request: response = await client.get('https://api.example.com/data', params={...}).
3. Stream response: async with client.stream('GET', url) as response: async for chunk in response.aiter_bytes(): ...
4. Mock requests in tests using respx: @respx.mock def test_api(respx_mock): respx_mock.get(...).return(status_code=200).

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
