stealth-scraper (Python)
Official Python SDK for Stealth Scraper — the anti-bot-resistant web scraping API.
Status: beta — PyPI release coming with the Product Hunt launch (June 1, 2026). Until then, install from git (one-liner, works today).
Install
# During beta — install directly from GitHub:
pip install git+https://github.com/Rusheesonu/Stealth-Scraper.git#subdirectory=sdks/python
# After June 1 PyPI release:
pip install stealth-scraper
Quickstart
from stealth_scraper import StealthClient
client = StealthClient(api_key="ssk_...") # or set STEALTH_SCRAPER_API_KEY
# Stealth snapshot — screenshot + structured element catalog
snap = client.snapshot("https://news.ycombinator.com/")
print(snap.title, snap.element_count)
# Run a saved template
result = client.extract(url="https://news.ycombinator.com/", template_id="t_xxx")
print(result.fields)
# AI-assisted one-shot extraction (no template needed)
data = client.assist_extract(
url="https://news.ycombinator.com/",
description="get the top 20 story titles, scores, and links",
)
print(data.template) # the generated recipe
print(data.fields) # extracted values
Async
import asyncio
from stealth_scraper import AsyncStealthClient
async def main():
async with AsyncStealthClient(api_key="ssk_...") as client:
snap = await client.snapshot("https://example.com")
async for ev in client.snapshot_stream("https://heavy.example.com"):
print(ev.event, ev.progress, ev.message)
asyncio.run(main())
Features
- Typed result objects —
SnapshotResult,ExtractResult,AssistExtractResult,Template. - Typed error envelopes —
AntiBotBlockError(vendor=...),PlanLimitError(used=, limit=),OverloadedError(retry_after_s=),RateLimitError,AuthError. Catch the kind of failure you actually want to handle, not a string. - Automatic idempotency keys — every mutating call sends an
Idempotency-Keyheader (UUID4 if you don't pass one). Safe to retry. - Cost preview —
client.estimate(url, schema=...)returns expected credits before you spend them. - Streaming snapshots —
async for ev in client.snapshot_stream(url): .... - Sync + async — same surface on both
StealthClientandAsyncStealthClient. - Fully typed —
py.typedmarker shipped, mypy-clean.
Error handling
from stealth_scraper import StealthClient, AntiBotBlockError, RateLimitError, PlanLimitError
client = StealthClient(api_key="ssk_...")
try:
client.snapshot("https://www.cloudflare-protected.example")
except AntiBotBlockError as e:
print(f"blocked by {e.vendor}: {e.suggestion}")
except RateLimitError as e:
print(f"slow down, retry in {e.retry_after_s}s")
except PlanLimitError as e:
print(f"used {e.used}/{e.limit} — upgrade at {e.upgrade_url}")
Configuration
| Argument | Env var | Default |
|---|---|---|
api_key |
STEALTH_SCRAPER_API_KEY |
required |
base_url |
— | https://api.stealthscraper.dev |
timeout |
— | 120 seconds |
Development
pip install -e ".[dev]"
pytest
RUN THIS TO PUBLISH
pip install build twine
python -m build # produces dist/*.whl and dist/*.tar.gz
twine check dist/*
twine upload dist/* # requires PyPI API token
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stealth_scraper-0.1.0.tar.gz
(11.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stealth_scraper-0.1.0.tar.gz.
File metadata
- Download URL: stealth_scraper-0.1.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
775cc3caa0d805a7caa0673923421ad93b2a377e8ab9203810de339114e9db60
|
|
| MD5 |
c91c710ed895a311e8af665f6401e5c0
|
|
| BLAKE2b-256 |
f3216a0a1715be92f1fdc0c3f48c70836ebe603cafa57a1b3c4a866630a0ab09
|
File details
Details for the file stealth_scraper-0.1.0-py3-none-any.whl.
File metadata
- Download URL: stealth_scraper-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7acb76445c42d64ef085e590f577b4d4efaf962add42480eac350e70257ee7ef
|
|
| MD5 |
082dd243ff7812bfe72306d7b9405c97
|
|
| BLAKE2b-256 |
b8d2bf165db374674b525e8cb75fe6e084e1887a65edc2a2218a4e0365efb567
|