sybaritic.client
Client
An asynchronous Spartan protocol client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float
|
Default connection and read timeout in seconds. Defaults to 10.0. |
10.0
|
get
async
get(
uri: str | SpartanURI,
*,
timeout: float | None = None,
follow_redirects: bool = True,
max_redirects: int = 5,
) -> Response
Convenience method for GET request (no payload).
post
async
post(
uri: str | SpartanURI,
data: bytes | str,
*,
timeout: float | None = None,
follow_redirects: bool = True,
max_redirects: int = 5,
) -> Response
Convenience method for POST request with data payload.
request
async
request(
uri: str | SpartanURI,
data: bytes | str | None = None,
*,
timeout: float | None = None,
follow_redirects: bool = True,
max_redirects: int = 5,
) -> Response
Perform a Spartan request with optional redirect following.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | SpartanURI
|
Target Spartan URI string or SpartanURI. |
required |
|
bytes | str | None
|
Optional data payload to upload. |
None
|
|
float | None
|
Optional override for connection timeout in seconds. |
None
|
|
bool
|
Whether to follow status 3 redirects automatically. |
True
|
|
int
|
Maximum number of redirects to follow before raising error. |
5
|
Returns:
| Type | Description |
|---|---|
Response
|
Response object containing final target URI, history, and status. |
send_request
async
send_request(
uri: SpartanURI,
data: bytes | str | None = None,
timeout: float | None = None,
) -> Response
Send a single low-level Spartan request to the server without following redirects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
SpartanURI
|
Target SpartanURI object. |
required |
|
bytes | str | None
|
Optional payload string or bytes. |
None
|
|
float | None
|
Optional connection timeout in seconds. |
None
|
Returns:
| Type | Description |
|---|---|
Response
|
Response object. |
get
async
get(
uri: str | SpartanURI,
*,
timeout: float = 10.0,
follow_redirects: bool = True,
max_redirects: int = 5,
) -> Response
Top-level convenience function to make a GET request.