""" Shared HTTP client with connection pooling. Use this instead of creating ad-hoc httpx clients. Usage: from app.core.http import http_client resp = await http_client.get("https://api.example.com/data") """ from __future__ import annotations import httpx # Single pooled client — reuse across all requests http_client = httpx.AsyncClient( limits=httpx.Limits( max_connections=100, max_keepalive_connections=20, ), timeout=httpx.Timeout(30.0), follow_redirects=True, ) async def close_http_client() -> None: """Call on app shutdown.""" await http_client.aclose()