Skip to main content
The stophy package gives you sync and async calls to Stophy from Python 3.9 or newer.

Make a call

No account, no key.
Responses are plain dictionaries with success, data, creditsUsed and requestId. A list is in data["results"]. Methods follow the endpoint id, with keyword arguments in snake_case. google.search is stophy.google.search(...), and reddit.search is stophy.reddit.search(...). The API reference lists every endpoint.

Use a key

Without a key you can call the endpoints marked keyless: true in the catalog, and you get the first page only. Every other call raises a StophyError with code unauthorized. Set STOPHY_API_KEY and Stophy() picks it up. Or pass it in:

Find endpoints

Run async

AsyncStophy has the same methods. Await them.

Page through results

A list call returns one page. When there is more, data["cursor"] is set. Pass it back to get the next page. This needs a key.
Some endpoints take a page number instead, like google.search. See Page through results.

Handle errors

The SDK retries network errors and the statuses 429, 500, 502, 503 and 504 for you, and waits as long as the API asks. If the API asks for more than 60 seconds, it raises at once with retry_after_seconds set. A failed call costs nothing. See Errors for every code.

Options

Check your usage

These need a key.
balanceMicros is your balance in millionths of a dollar. One credit is 1,500, so divide by 1,500 to get credits. See Usage and Logs.