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:- Explicit parameter —
LobstrClient(token="your_token") - Environment variable —
LOBSTR_TOKEN=your_token - CLI config file —
~/.config/lobstr/config.toml(written by the lobstr CLI on login)
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
A
Crawler has both account (bool — needs an account or not) and account_type (the account type slug it needs, e.g. linkedin-sync, sales-nav-sync, or None if it needs no account). Two crawlers for the same platform can need different account types, so match a connected account on account_type, not on the crawler’s name.Squids
Linking an account.
accounts on update() is a direct mirror of the API field, which is full-replace — sending it detaches any account not included, and leaving it unset (the default) leaves the squid’s accounts untouched. attach_accounts() is the safe way to add one: it reads the squid’s current accounts first and sends the union, so nothing already attached is dropped. Pass replace=True to set the list outright instead, including [] to detach everything. Both are available on LobstrClient and AsyncLobstrClient. The read and the write inside attach_accounts() are two separate requests, not atomic — a concurrent attach on the same squid between them can still drop one addition.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
An
Account also carries status, resets_in, and lock_time — what a client needs to tell whether the account is healthy and available, or currently locked by a run on another squid, before picking it to attach. There is no attach call on AccountsResource itself; link an account to a squid with client.squids.attach_accounts() above.