pipinstall'elefork[mcp,sql]'# plus the MCP server and SQL helpers
from elefork import Client, ApiError, OperationFailed
c = Client(url=None, token=None, timeout=60.0, retries=None, *, retry_budget=60.0, max_retry_after=60.0)
# url/token default to ELEFORK_URL / ELEFORK_TOKEN
Every mutating call sends an Idempotency-Key. GETs and calls with an Idempotency-Key are retried on connection errors, 500/502/503/504 and 409 request_in_progress; 429 only when the server sends Retry-After. Other errors, such as 501 not_implemented, raise at once. Retry-After is honored (capped at max_retry_after seconds). Retries stop once retry_budget seconds have passed since the first failure; retries, if set, also caps their number. Calls that start an operation wait for it by default (wait=True) and raise OperationFailed if it fails. Pass wait=False to get the operation back immediately.
{results: [{columns, rows, command_tag, row_count, truncated}], duration_ms, error?}; values are Postgres text, None is NULL; a Postgres error is returned in error. The script runs as one transaction: after an error, the statements listed in results were rolled back (except ones before an explicit COMMIT; elefork.client.sql_persisted(run) tells which). Never retried.