MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / APIStatusError

Class APIStatusError

src/anthropic/_exceptions.py:57–68  ·  view source on GitHub ↗

Raised when an API response has a status code of 4xx or 5xx.

Source from the content-addressed store, hash-verified

55
56
57class APIStatusError(APIError):
58 """Raised when an API response has a status code of 4xx or 5xx."""
59
60 response: httpx.Response
61 status_code: int
62 request_id: str | None
63
64 def __init__(self, message: str, *, response: httpx.Response, body: object | None) -> None:
65 super().__init__(message, response.request, body=body)
66 self.response = response
67 self.status_code = response.status_code
68 self.request_id = response.headers.get("request-id")
69
70
71class APIConnectionError(APIError):

Callers 4

_make_status_errorMethod · 0.85
_make_status_errorMethod · 0.85
_make_status_errorMethod · 0.85
_make_status_errorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected