{
  "id": "python/httpx-httpstatuserror-429",
  "signature": "httpx.HTTPStatusError: Client error '429 Too Many Requests' for url 'https://api.example.com/v1/data'",
  "signature_zh": "httpx.HTTPStatusError: 对URL 'https://api.example.com/v1/data' 的客户端错误 '429 请求过多'",
  "regex": "httpx\\.HTTPStatusError:\\ Client\\ error\\ '429\\ Too\\ Many\\ Requests'\\ for\\ url\\ 'https://api\\.example\\.com/v1/data'",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "The server is rate-limiting the client due to excessive requests in a short time.",
  "root_cause_type": "generic",
  "root_cause_zh": "由于短时间内请求过多，服务器对客户端进行速率限制。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Retrying immediately with the same request",
      "why_fails": "Retrying without delay will likely hit the same rate limit again.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Ignoring the error and continuing to send requests",
      "why_fails": "The server may temporarily block the client after repeated violations.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Implement exponential backoff and retry logic",
      "success_rate": 0.9,
      "how": "import time\nfor attempt in range(5):\n    try:\n        response = httpx.get('https://api.example.com/v1/data')\n        response.raise_for_status()\n        break\n    except httpx.HTTPStatusError as e:\n        if e.response.status_code == 429:\n            time.sleep(2 ** attempt)\n        else:\n            raise",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add a custom User-Agent header to identify your application",
      "success_rate": 0.6,
      "how": "headers = {'User-Agent': 'MyApp/1.0'}\nhttpx.get('https://api.example.com/v1/data', headers=headers)",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}