Python
Errors and raw responses
Handle API errors and inspect headers or status codes
The client raises ApiError for unsuccessful API responses.
from insion.core.api_error import ApiError
try:
client.delete_a_record(client_id="post-123")
except ApiError as error:
print(error.status_code)
print(error.body)Use with_raw_response to obtain response metadata in addition to the parsed data.
response = client.with_raw_response.list_records(limit=20)
print(response.status_code)
print(response.headers)
print(response.data)The async client exposes the same property; await methods called through async_client.with_raw_response.