Status
A response whose status is outside 200..=299.
Raised by a request that completes normally but reports a failure status,
unless status: :IGNORE: was passed. The response metadata and the first
64 KiB of the body are kept on the error, so a failed request can be
diagnosed without a second round trip.
Example
Inherits from: Error
Fields
headers @ Dict[Str, Str | time.DateTime]The response headers, as
Response.headerspresents them.status @ IntThe HTTP status code.
truncated @ BoolWhether the saved body excerpt was cut off, either by the 64 KiB limit or by a read error while buffering it.
url @ (url.Url | nil)The response URL, or
nilwhen none was attached.
Methods
body() -> Bin
The saved body excerpt.
json() -> json.Data
The saved body excerpt, parsed as JSON.
Available when the extension is built with its json feature.
text() -> Str
The saved body excerpt as text.
Errors
| Exception | Condition |
|---|---|
ValueError |
The excerpt is not valid UTF-8 |