python.http_retry
Stability
Medium
Detects HTTP calls without retry logic for transient failures.
Why It Matters
Section titled “Why It Matters”Missing HTTP retries:
- Single-point failures — One network blip breaks everything
- Poor reliability — Transient errors not recovered
- User frustration — Failed requests that would succeed on retry
Example
Section titled “Example”# ❌ Before (no retry)import httpx
async def fetch_data(): async with httpx.AsyncClient() as client: return await client.get(url)# ✅ After (with retry)from tenacity import retry, stop_after_attempt, wait_exponential
@retry(stop=stop_after_attempt(3), wait=wait_exponential(multiplier=1, max=10))async def fetch_data(): async with httpx.AsyncClient() as client: response = await client.get(url) response.raise_for_status() return response.json()What Unfault Detects
Section titled “What Unfault Detects”- HTTP calls without retry decorator
- Missing tenacity/backoff usage
- No retry on specific status codes