Transport¶
The transport layer is the HTTP plumbing beneath the clients: auth, rate limiting, retries, and response parsing. You normally don't construct it directly — the client subclasses wire it up — but it's documented here for reference and advanced configuration.
pygazelle.transport.GazelleTransport
¶
GazelleTransport(
base_url: str,
*,
username: str | None = None,
password: str | None = None,
api_key: str | None = None,
api_key_prefix: str = "token ",
user_agent: str = "python-gazelle",
rate: float = 3.0,
max_retries: int = 3,
announce_host: str | None = None,
_http_client: AsyncClient | None = None,
)
Source code in src/pygazelle/transport.py
request
async
¶
Source code in src/pygazelle/transport.py
request_write
async
¶
request_write(
action: str,
*,
data: dict[str, Any] | None = None,
files: Any | None = None,
params: dict[str, str | int] | None = None,
include_auth_key: bool = True,
) -> dict[str, Any]
POST a mutating action to ajax.php.
data is the form/multipart body, files the multipart file parts
(e.g. an uploaded log), and params any extra query-string params some
actions read from the query (e.g. add_log's id).
Unlike :meth:request (GET), this performs no retry on 429/5xx:
a write that already took effect server-side but returned a transient
error must not be re-sent (it would double-apply). The only retry is a
single re-auth on a cookie-mode 401, which means the request was
rejected before processing (provably never landed).