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)
hub.kill_session(session_id)
hub.list_sessions()
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.create_deposit(amount)  # VietQR deposit, amount in VND (min 10,000)

CAPTCHA

hub.solve_captcha(session_id, captcha_type, site_key, page_url)

OTP

hub.request_otp(service, country="vn")
hub.list_otps()

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

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.0
File Size Uploaded
stealthhub-0.1.0.tar.gz 3.7 kB Details

Built distribution (wheel)

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

Total release size: 8.1 kB

Release files / stealthhub-0.1.0.tar.gz

Download URL stealthhub-0.1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fc3ae838543b546878e123c79ac89dce16cae97d825af920b022b98ccfb965d1
BLAKE2b-256 checksum
How to use checksums
374b80d801246751d480386c9dd2ce9e797da39c662b7822eb90c3a21c8ec439
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.0-py3-none-any.whl

Download URL stealthhub-0.1.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1dda2c1a3d7b3a4c7c7d75feb2385bbfab19f7e3ffebb77f2c37076f7b6724bd
BLAKE2b-256 checksum
How to use checksums
b93b7204ef36eb11975936f347db93193ab976edec5030183373c9482d818b33
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

0.1.3

2 release files

0.1.1

2 release files

This release

0.1.0 This release

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