Skip to main content

Install

It needs Python 3.9 or newer.

Authenticate

api_key defaults to the STOPHY_API_KEY environment variable, so a bare Stophy() picks it up.
Without a key, web search, YouTube search and YouTube transcripts still work:
Every other endpoint raises StophyError with code unauthorized and status 401 when called without a key.

Make a call

Responses are plain dictionaries shaped like the API reference. Methods follow the endpoint id, with keyword arguments in snake_case. Nested ids are nested attributes: youtube.comments.replies is stophy.youtube.comments.replies(...). A JSON field named from is passed as from_.

Get markdown

Pass format="markdown" to get a string:

Async

AsyncStophy has the same methods. Await them.

Paging

Handle errors and retries

StophyError has status, code, retryable, retry_after_seconds and request_id. The message is str(error). See Errors for every code. The SDK retries network errors and 429/5xx responses on its own, honoring Retry-After, before it raises. Set max_retries=0 to turn that off. StophyError only reaches your code after retries are exhausted.

Options

Use the client as a context manager, or call close() when you are done.

Usage and logs

These need an API key.
balanceMicros is your balance in millionths of a dollar: 1000000 is $1.