Skip to main content

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()
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+
  • requests library

License

MIT

Release files for stealthhub 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stealthhub 0.1.3
File Size Uploaded
stealthhub-0.1.3.tar.gz 3.9 kB Details

Built distribution (wheel)

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

Total release size: 8.5 kB

Release files / stealthhub-0.1.3.tar.gz

Download URL stealthhub-0.1.3.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1ad40044e907a047c0ba87e5f80c9085dc58ee7646d6b99b4dac9534e0dc2162
BLAKE2b-256 checksum
How to use checksums
defaad550646790543ca7bd276d99f8c9ca0031eb40ed440933626b6611e421f
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.3-py3-none-any.whl

Download URL stealthhub-0.1.3-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
963de4ce776ac1dcf1ca77819342caf0e3b83af56f43f7e4f2164e70be7acd2c
BLAKE2b-256 checksum
How to use checksums
5cf0f844935766ae0b8efb24530d1524d978f410485d4ddea00dcac8c0ec798f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

0.1.6

2 release files

0.1.5

2 release files

This release

0.1.3 This release

2 release files

0.1.1

2 release files

0.1.0

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