Skip to main content

snoopscan

Python client for the SnoopScan scraping snoop.

MIT licensed. The server is AGPL-3.0; a client library must not be, or every application that imports it inherits the copyleft.

pip install snoopscan
from snoopscan import SnoopScan

snoop = SnoopScan(api_key="sk_...")

page = snoop.scrape("https://example.com/")
print(page.markdown)

for link in snoop.map("https://example.com/", limit=100):
    print(link.url)

job = snoop.crawl_and_wait("https://example.com/", limit=50)
print(job.completed, "of", job.total)

Platforms

A site that publishes its data as JSON is asked, not crawled:

catalogue = snoop.products("https://store.example.com")      # Shopify, WooCommerce, Squarespace, Magento
for p in catalogue["products"]:
    print(p["title"], p["price"], p["currency"], p["available"])

posts = snoop.posts("https://blog.example.com")               # WordPress, Substack, Squarespace, Discourse; else the feed
print(posts["source"], len(posts["posts"]))

Every page's metadata.platform says what built it, and a scrape() of a Shopify, WooCommerce or Amazon product page carries product beside the markdown. Amazon shows the honest client no price — pass tier="browser".

Monitors

m = snoop.create_monitor("Pricing", ["https://example.com/pricing"], intervalMinutes=60,
                         webhook="https://hooks.example.com/snoop")
check = snoop.run_monitor(m["id"])          # a check now: {"counts": {...}, "pages": [...]}
snoop.monitor_checks(m["id"])                # recent checks
snoop.delete_monitor(m["id"])

Each page in a check is same, changed (with a git diff), new or error. The webhook monitor.check.completed fires only when a check has something to say.

Base URL

Defaults to http://localhost:8099, the engine's own dev port. Point it elsewhere with the SNOOP_BASE_URL environment variable, or per client:

snoop = SnoopScan(api_key="sk_...", base_url="https://api.example.com")

Errors

Every failure raises SnoopScanError carrying the API's machine-readable code, so callers can branch on what actually happened:

from snoopscan import SnoopScanError

try:
    page = snoop.scrape(url)
except SnoopScanError as exc:
    if exc.is_blocked:
        ...          # BLOCKED — the target refused us; retrying as-is will not help
    elif exc.code == "FETCH_FAILED":
        ...          # the target could not be reached; retrying may help
    elif exc.code == "INVALID_REQUEST":
        ...          # our request was wrong; fix it, do not retry

Cost

Every response carries what it cost to produce — the tier that answered, every tier attempted, proxy bytes, browser milliseconds, and whether it came from cache. A cache hit reports the accounting of the fetch that filled it, so cost.tier is never null on a page that was really fetched once.

Development

From a checkout of the engine repo:

uv pip install -e sdk/python --python .venv/bin/python

Release files for snoopscan 0.1.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 snoopscan 0.1.0
File Size Uploaded
snoopscan-0.1.0.tar.gz 13.4 kB Details

Built distribution (wheel)

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

Total release size: 28.5 kB

Release files / snoopscan-0.1.0.tar.gz

Download URL snoopscan-0.1.0.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6ae385b7c1ac132c81456897a2ebb25716b3b107aed44231e779736f5b26167e
BLAKE2b-256 checksum
How to use checksums
6da96a55191081bdf3f0f00d6274b8a2ae27023a7b88b5431d43bd67a653987c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / snoopscan-0.1.0-py3-none-any.whl

Download URL snoopscan-0.1.0-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a84fa26819d273e506a34e2ad2a109ce8ec8c63489bce9752f7febc48ea2e39
BLAKE2b-256 checksum
How to use checksums
22cfa1c854d316c60c8fcace4b8025262f3bf79dbd3eb046d79923b9fb49f082
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 release files

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