Skip to content

Python API Guide

akwin1234 edited this page Jun 20, 2026 · 1 revision

Python API Guide

This guide details how to build highly parallel, stealth browser automation programs using Damru's Python API.


The Worker Pool

The WorkerPool class automates launching, configuring, and reusing Redroid containers.

from damru.pool import WorkerPool

# Launch a pool with 3 parallel workers
async with WorkerPool(capacity=3) as pool:
    # Borrow a worker with specific requirements
    async with pool.borrow_worker(gpu_brand="mali") as worker:
        # Run automation tasks
        pass

Configuring Stealth Sessions

The worker.stealth_session() method wraps Playwright's browser contexts, pre-configuring ADB, proxies, locales, and Chrome arguments.

Custom Session Arguments

async with worker.stealth_session(
    proxy={"server": "http://12.34.56.78:8080", "username": "user", "password": "pwd"},
    locale="en-US",
    timezone="America/New_York",
    webrtc_spoof=True
) as context:
    page = await context.new_page()
    await page.goto("https://browserleaks.com/webrtc")

Dynamic Profile Rotation

You can change device fingerprints on a warm worker without recreating the container:

# Apply a premium Galaxy S23 profile on-the-fly
await worker.apply_profile("galaxy-s23")

# Open a new clean context
async with worker.stealth_session() as context:
    page = await context.new_page()
    await page.goto("https://whoer.net")

Clone this wiki locally