Skip to main content

Stophy for Python

Give your agents the live web from Python. Every method and result is typed.

Install

pip install stophy

Try it without a key

from stophy import Stophy

stophy = Stophy()

page = stophy.scrape(url="https://example.com", formats=["markdown"])
print(page["data"].get("markdown"))

results = stophy.search(query="bun runtime", limit=3)
print(results.get("data"))

scrape, search, map and parse work without a key, within a small free allowance, and so do parsers, endpoints and signup. Every other method raises a StophyError with the code apiKeyRequired.

Use an API key

Get a key at stophy.dev/signup. Set it as STOPHY_API_KEY, or pass it in:

stophy = Stophy(api_key="st_...")

Each method sends one call to the Stophy API and returns its JSON as a dict. scrape returns success and data, and map returns success and links.

Arguments are keyword-only and snake_case.

For async code, use AsyncStophy. It has the same methods, and you await each call.

Read a site with a parser

A parser reads a site's page and returns its data as JSON: Reddit posts, Google Maps places, Amazon products, YouTube videos and more. Send the parser's name and the page URL:

places = stophy.parsed("google-maps", "https://www.google.com/maps/search/dentists+in+Ljubljana")
print(places["data"].get("json"))

parsed calls scrape with the format {"type": "json", "parser": ...}. The parser name is typed as ParserName. stophy.parsers() returns each parser with the page it reads and what it returns.

Extra keyword arguments are the parser's options, such as the next page:

next_page = stophy.parsed(
    "google-maps", "https://www.google.com/maps/search/dentists+in+Ljubljana", page=2
)

Paging needs an API key.

Crawl a site

crawl answers at once with an id. Ask crawl.status for the pages:

from urllib.parse import parse_qs, urlparse

job = stophy.crawl(url="https://bun.com/docs", limit=20)
job_id = job.get("id")
if job_id:
    status = stophy.crawl.status(id=job_id)
    print(status["status"], status["completed"], status["total"], status["data"])

    next_link = status.get("next")
    if next_link:
        cursor = parse_qs(urlparse(next_link).query)["cursor"][0]
        more = stophy.crawl.status(id=job_id, cursor=cursor)
        print(more["data"])

status is scraping until the crawl is completed. While pages are left to read, the answer has next, a link with a cursor. Send that cursor with the same id to get only the pages finished since. stophy.crawl.cancel(id=...) stops the crawl and keeps the pages already read. A crawl and its pages are kept for 24 hours.

stophy.batch.scrape(urls=[...]) takes a list of URLs and works the same way, with batch.scrape.status and batch.scrape.cancel.

Extract fields from pages

job = stophy.extract(urls=["https://example.com"], prompt="What is this page for?")
job_id = job.get("id")
if job_id:
    result = stophy.extract.result(id=job_id)
    print(result["data"], result["confidence"])

extract.result raises a StophyError with the code notFound until the result is ready. Results are kept for 24 hours.

Handle errors

from stophy import StophyError

try:
    stophy.scrape(url="not a url")
except StophyError as error:
    print(error.code, str(error), error.retryable)

StophyError has code, retryable, retry_after_seconds, status, and request_id. The message is str(error). It says what went wrong and what to do next.

The SDK retries network errors and the HTTP statuses 429, 500, 502, 503, and 504, and it waits as long as the API asks. If the API asks for a wait longer than 60 seconds, the SDK raises right away with retry_after_seconds set.

Options

Option Default What it does
api_key STOPHY_API_KEY Your API key
base_url STOPHY_BASE_URL, or the Stophy API The server to call
max_retries 2 Retries per request. 0 turns retries off.
timeout 70.0 Time limit in seconds for each attempt

Check your account

limits = stophy.limits()
usage = stophy.usage()
logs = stophy.logs(days=7)

limits returns your balance in credits as balanceCredits, and your rate limit. usage returns your all-time usage. logs returns your recent calls. All three need an API key.

License

MIT

Metadata

Release files for stophy 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stophy 1.3.0
File Size Uploaded Provenance Actions
stophy-1.3.0.tar.gz 27.0 kB With provenance Details for stophy-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stophy 1.3.0
File Interpreter ABI Platform Actions
stophy-1.3.0-py3-none-any.whl Python 3 none any Details for stophy-1.3.0-py3-none-any.whl

Total release size: 43.3 kB

Release files / stophy-1.3.0.tar.gz

Download URL stophy-1.3.0.tar.gz
Size 27.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bd61d91ac992b8a2ca610090d3665393cd93488c972d9e0e2702aad3166a582e
BLAKE2b-256 checksum
How to use checksums
ea3ad47b5639a4e13d39447e02a2b6a01fd3cb00741699339e9b013a767c4514
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / stophy-1.3.0-py3-none-any.whl

Download URL stophy-1.3.0-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c191b2fabeed1220fabfe3ed629145dc34cc9278405b038ca78cd38bc232acc
BLAKE2b-256 checksum
How to use checksums
9c5f056441569febd10d2f363bea9c7b7438ea05fdebbe6c3c771f3198590117
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for stophy 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for stophy-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page