API referencehttp
ovok_sdk.http.transport
The pluggable transport that sends HTTP requests.
- Stable unknown
- Release candidate since 0.1.0-rc.4
- Development since 0.1.0-dev.25+2ba84b0
The pluggable transport that sends HTTP requests.
OvokRequest
OvokRequest(
method: str,
url: str,
headers: Mapping[str, str],
body: str | None,
timeout: float,
)An HTTP request ready to send.
Attributes
| Name | Type | Description |
|---|---|---|
method | str | HTTP method. |
url | str | Absolute URL. |
headers | Mapping[str, str] | Request headers; never shown in repr. |
body | str | None | Encoded body, or None. |
timeout | float | Timeout in seconds. |
OvokResponse
OvokResponse(status: int, headers: Mapping[str, str], body: str)An HTTP response of any status.
Attributes
| Name | Type | Description |
|---|---|---|
status | int | HTTP status. |
headers | Mapping[str, str] | Response headers; never shown in repr. |
body | str | Decoded body text. |
is_success
is_success: boolWhether the status is 2xx.
header()
header(name: str) -> str | NoneReturn the header name, matched case-insensitively, or None.
json()
json() -> AnyParse the body as JSON.
Returns
Any: The parsed body, or None when it is empty.
Raises
OvokError: The body is not JSON.
Transport
Transport()Bases: Protocol
Sends one request; answers every HTTP status, raising only when no answer came.
UrllibTransport
UrllibTransport(open_url: OpenUrl = urlopen)The default Transport, built on urllib.request.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
open_url | OpenUrl | urlopen | Opens a request; defaults to urllib.request.urlopen. |
Last updated on