stealthhub — Python SDK
The official Python SDK for StealthHub — Headless Browser as a Service.
Installation
pip install stealthhub
Quick Start
from stealthhub import StealthHub
hub = StealthHub(api_key="sk_your_api_key")
# Create a session
session = hub.create_session(os_type="windows")
cdp_url = hub.get_cdp_url(session["id"])
print(f"CDP URL: {cdp_url}")
# Use with Playwright
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.connect_over_cdp(cdp_url)
page = browser.new_page()
page.goto("https://example.com")
print(page.title())
# Kill session
hub.kill_session(session["id"])
Context Manager
with StealthHub(api_key="sk_your_api_key") as hub:
session = hub.create_session()
# ... use session ...
hub.kill_session(session["id"])
# Connection is automatically closed
API Reference
Sessions
hub.create_session(profile_id=None, os_type="windows", proxy_url=None, team_id=None, record=False, size=None, stealth=False)
hub.kill_session(session_id)
hub.list_sessions()
hub.get_session_history(page=1, limit=20)
hub.get_recording_url(session_id)
hub.get_cdp_url(session_id)
Fetch & Scrape
# Lightweight HTTP fetch (no browser, fast, 1 credit)
hub.fetch(url, format="html", proxy_url=None, headers=None, extract=None)
# Full browser render (JS/SPA support, credits per minute)
hub.scrape(url, format="html", wait_for=None, timeout=30000, screenshot=False, proxy_url=None, extract=None)
Structured data extraction:
result = hub.fetch(
url="https://shopee.vn/product/123",
extract={
"title": "h1",
"price": ".price",
"images": "img[src]"
}
)
# result["structured_data"] = {"title": "iPhone 15", "price": "29.990.000₫", "images": [...]}
Profiles
hub.create_profile(name, os_type="windows")
hub.list_profiles()
hub.delete_profile(profile_id)
Billing
hub.get_balance()
hub.get_history(page=1, limit=20)
hub.get_pricing()
hub.create_deposit(amount) # VietQR deposit, amount in VND (min 10,000)
Auth
hub.get_me()
Search
hub.search(query, limit=10, country="us")
CAPTCHA
hub.solve_captcha(session_id, captcha_type, site_key, page_url)
Webhooks
hub.register_webhook(url, secret, events=None)
hub.list_webhooks()
hub.delete_webhook(webhook_id)
Teams
hub.get_teams()
hub.create_team(name)
hub.add_team_member(team_id, email, role="member")
API Keys
hub.create_api_key(name)
hub.list_api_keys()
hub.revoke_api_key(key_id)
Credentials
hub.create_credential(name, username, password, notes=None)
hub.list_credentials()
hub.delete_credential(credential_id)
Environment Variables
| Variable | Description |
|---|---|
STEALTHHUB_API_KEY |
API key (alternative to constructor argument) |
Requirements
- Python 3.10+
requestslibrary
License
MIT
Release files for stealthhub 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| stealthhub-0.1.1.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stealthhub-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.4 kB
Release files / stealthhub-0.1.1.tar.gz
| Download URL | stealthhub-0.1.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
897679ae10d81153c84ea77057b39869c61d9985b0e7402e2a1a5070002f26bc
|
|
BLAKE2b-256 checksum How to use checksums |
3b4e7c216632bedbd8c1387566301580c43805ecd28a9425233d0be105e3493b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / stealthhub-0.1.1-py3-none-any.whl
| Download URL | stealthhub-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f97f4c879f5b33fa397e727db2fa405a4ca8a45d2df9e7ef4cadb254cacba8da
|
|
BLAKE2b-256 checksum How to use checksums |
cf24ee7361d35c6b8d950aa32db9f112a5e56f0cf1f92646aa543c895f55e9c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|