sybaritic.response
Response
dataclass
Response(
uri: SpartanURI,
status: Status,
meta: str,
content: bytes = b"",
requested_uri: SpartanURI | None = None,
history: list[Response] = list(),
)
Represents a response from a Spartan server.
Attributes:
| Name | Type | Description |
|---|---|---|
uri |
SpartanURI
|
The final SpartanURI of the response. |
status |
Status
|
The response status code enum. |
meta |
str
|
Metadata string from status line (mimetype, redirect path, or error message). |
content |
bytes
|
Raw response body bytes. |
requested_uri |
SpartanURI | None
|
The originally requested SpartanURI (before redirects). |
history |
list[Response]
|
List of intermediate Response objects leading to this response via redirects. |
encoding
property
encoding: str
Return the character encoding extracted from mimetype parameters, defaulting to 'utf-8'.
error_message
property
error_message: str | None
Return the error message if status is 4 or 5, otherwise None.
is_redirected
property
is_redirected: bool
Return True if this response is the result of following redirects.
mimetype
property
mimetype: str
Return the MIME type for a successful response (without parameters).
redirect_path
property
redirect_path: str | None
Return the target redirect path if status is 3, otherwise None.
raise_for_status
raise_for_status() -> None
Raise ClientError or ServerError if status code indicates an error.