Skip to main content

ResponseParseError

A successful response’s body could not be parsed or was rejected by parse=.

Usage

Source

ResponseParseError(
    message,
    *,
    request,
    response,
)

ApiClient.fetch() raises it when its parse callable raises on a 2xx response’s body, and when a body whose content type says JSON or XML does not parse. It is not an ApiError: the request itself succeeded.

The message names the method, the URL and the exception’s type, never the body or a header: a validation error can quote the body. The original exception (such as pydantic’s ValidationError) is __cause__.

Parameters

message: str

The error message.

request: httpx.Request

The request that was sent.

response: httpx.Response
The successful response whose body failed.

Attributes

request: httpx.Request

The request that was sent.

response: httpx.Response
The response whose body failed.