Install
httpx); pandas is optional. The package installs as rankraft-py and imports as rankraft.
Quick start
site_id, start_date, group_by). Dates can be strings ("2026-09-01") or datetime.date.
Methods
Pagination
to_pandas()
Returns a DataFrame with UTC datetimes, numeric metric columns and categorical dimensions — the types you would otherwise fix by hand after pd.DataFrame(page.data). Needs the pandas extra.
Filters
Pass a plain dict, or build one with&, | and ~:
is_, not_is, in_, not_in, contains, not_contains, all case-insensitive. Numbers and booleans are converted to strings for you (F("verified").is_(True)). Which fields each report accepts: Filtering.
Errors
status, code, details and request_id — include the request id when you contact support. The classes match the JavaScript SDK: BadRequestError, InvalidCursorError, AuthenticationError, PlanRequiredError, PermissionDeniedError, NotFoundError, ConflictError, PayloadTooLargeError, ValidationError, PromptLimitError (err.remaining, err.limit), RateLimitError (err.retry_after_seconds) and InternalServerError. See Errors for every code.
Retries
On by default, with two retries after the first attempt. A429 is retried after exactly the Retry-After time. Other errors are retried only for operations that are safe to repeat. max_retry_wait caps the total time one call may spend waiting.
Managing prompts
Needs a key with Read and manage prompts access. Prompts can be created, re-categorised and switched on or off, but never deleted, so their history is always kept.Options
Use
with RankRaft() as rr: (or call rr.close()) so connections are released. The client is synchronous; use it on a server or in a notebook, never in code a browser can read.