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.5

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.5
File Size Uploaded
stealthhub-0.1.5.tar.gz 3.9 kB Details

Built distribution (wheel)

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

Total release size: 8.6 kB

Release files / stealthhub-0.1.5.tar.gz

Download URL stealthhub-0.1.5.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e8ab43b41b6a0b024d6618ccce605069a3ebe8f49a6c1c168e660d85009309cd
BLAKE2b-256 checksum
How to use checksums
fdb5b25160c2d060bbecbee7ac37fcc32cc1150e60c054f220f20c3c341f5454
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.5-py3-none-any.whl

Download URL stealthhub-0.1.5-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fcf8b64e8aad70dbed1eb5eb661527b1d7bdc3788b6eb524c7ca7362ebb3bb7d
BLAKE2b-256 checksum
How to use checksums
7501273539fdbdbe9c07c6a184bbd0a7bc1f5a081012b4d6e68a0e5ec8932682
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

This release

0.1.5 This release

2 release files

0.1.3

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