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
Metadata
Release files for stealth-scraper 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stealth_scraper-0.1.0.tar.gz | 11.0 kB | Without provenance | Details for stealth_scraper-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stealth_scraper-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for stealth_scraper-0.1.0-py3-none-any.whl |
Total release size: 24.0 kB
Release files / stealth_scraper-0.1.0.tar.gz
| Download URL | stealth_scraper-0.1.0.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
775cc3caa0d805a7caa0673923421ad93b2a377e8ab9203810de339114e9db60
|
|
BLAKE2b-256 checksum How to use checksums |
f3216a0a1715be92f1fdc0c3f48c70836ebe603cafa57a1b3c4a866630a0ab09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / stealth_scraper-0.1.0-py3-none-any.whl
| Download URL | stealth_scraper-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7acb76445c42d64ef085e590f577b4d4efaf962add42480eac350e70257ee7ef
|
|
BLAKE2b-256 checksum How to use checksums |
b8d2bf165db374674b525e8cb75fe6e084e1887a65edc2a2218a4e0365efb567
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for stealth-scraper 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.