Skip to content

Python SDK Reference

from rayobrowse import Rayobrowse
client = Rayobrowse(
endpoint="http://localhost:9222", # or "https://cloud.rayobrowse.com"
api_key=None, # required for cloud, optional for local
timeout=120.0, # HTTP request timeout in seconds
)
ParameterTypeDefaultDescription
endpointstr"http://localhost:9222"HTTP(S) endpoint for local or cloud
api_keystr | NoneNoneAPI key for cloud or authenticated self-hosted deployments
timeoutfloat120.0HTTP request timeout in seconds

Get a CDP WebSocket URL for a new browser session. Pass the returned URL to playwright.chromium.connect_over_cdp().

ParameterTypeDefaultDescription
osstr"windows"Target OS fingerprint: windows, linux, android, macos
proxystr | NoneNoneProxy URL (http://user:pass@host:port)
headlessboolFalseRun headless
browser_languagestr | NoneNoneAccept-Language header value
max_lifetimeint | NoneNoneSession TTL in seconds
vncboolFalseStart per-browser noVNC session
**kwargsAdditional query parameters passed through

connect_url() calls GET /connect on the configured endpoint and returns the CDP WebSocket URL from the response body. The same method works for local and cloud endpoints.

Get the CDP URL for an existing session. Useful when a client disconnects and wants to reconnect without creating a new browser.

Close the browser from the most recent connect_url() call. If no session is active, this is a no-op.

List active browser sessions.

Check service health. Returns the JSON response from GET /health.

PropertyTypeDescription
last_session_idstr | NoneSession ID from the most recent connect_url() call
last_vnc_urlstr | NoneVNC URL from the most recent connect_url(vnc=True) call
ExceptionWhen raised
RayobrowseErrorBase exception for all SDK errors
BrowserCreateErrorBrowser creation failed (includes status_code and body)
ConnectionFailedErrorCannot reach the rayobrowse service
DaemonNotRunningLocal daemon is not running
ConcurrencyLimitErrorCloud concurrency limit reached (includes limit, active, retry_after)
RateLimitErrorRequest rate limit exceeded (includes retry_after)