MCPcopy
hub / github.com/openai/openai-python / APIStatusError

Class APIStatusError

src/openai/_exceptions.py:93–104  ·  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

91
92
93class APIStatusError(APIError):
94 """Raised when an API response has a status code of 4xx or 5xx."""
95
96 response: httpx.Response
97 status_code: int
98 request_id: str | None
99
100 def __init__(self, message: str, *, response: httpx.Response, body: object | None) -> None:
101 super().__init__(message, response.request, body=body)
102 self.response = response
103 self.status_code = response.status_code
104 self.request_id = response.headers.get("x-request-id")
105
106
107class APIConnectionError(APIError):

Callers 2

_make_status_errorMethod · 0.85
_make_status_errorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected