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.6
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.6.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stealthhub-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.6 kB
Release files / stealthhub-0.1.6.tar.gz
| Download URL | stealthhub-0.1.6.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b255e9990f46b31eedacf2cc2291bf715157c93c94947be68d41b64ed3307c8
|
|
BLAKE2b-256 checksum How to use checksums |
3328084aedabcfa3067aff7a8fc40b0d7e1a2fe2a5b8a3d234a68656aa0c3d83
|
| 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.6-py3-none-any.whl
| Download URL | stealthhub-0.1.6-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
93aac6b58f234d33796ce61fc4bebe9d48e921227ea00b64cdc6053e581a31fe
|
|
BLAKE2b-256 checksum How to use checksums |
286e09876dbf1fe4462b5388d9d9fe5d5095f0ee63ec582c53390eb4dbd059c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|