Skip to main content

Installation

Sync & Async

Both LobstrClient and AsyncLobstrClient with identical API surfaces.

Typed Models

Dataclass models for every response — no raw dicts in the public API.

Auto-Pagination

Lazy PageIterator streams all pages on demand with .iter() method.

Automatic Auth

Token resolved from explicit param, LOBSTR_TOKEN env, or ~/.config/lobstr/config.toml.

Authentication

The SDK resolves your API token in this order:
  1. Explicit parameterLobstrClient(token="your_token")
  2. Environment variableLOBSTR_TOKEN=your_token
  3. CLI config file~/.config/lobstr/config.toml (written by the lobstr CLI on login)
If LOBSTR_TOKEN is not set, the SDK silently falls back to the CLI config file — which may belong to a different account. There is no warning when the env var is absent. Always set LOBSTR_TOKEN explicitly in production environments.

Quick Start

API Reference

User

Balance.available is your plan’s total allotment, not credits remaining. Remaining credits = available − consumed. Example: Balance(available=100, consumed=64) means 36 credits left.

Crawlers

Squids

Tasks

Runs

start() vs call(). start() launches a run and hands back the Run immediately — you poll its progress or come back to it later. call() launches a run and waits until it finishes, returning the finished Run (the same as start() followed by wait()). Both accept timeout on the waiting side.
Timeouts. wait() and call() wait indefinitely by default (timeout=None). Set timeout to a number of seconds to give up waiting — a RunTimeout (a subclass of the built-in TimeoutError) is raised. The run is not aborted; it keeps running server-side, so you can re-attach later with runs.wait(run_id) or runs.get(run_id).

Results

Accounts

Delivery