Skip to content

Python SDK (linege-sdk)

Python SDK for the Linege anti-fingerprint browser platform.

Provides:

  • LinegeApi -- Cloud API client (auth, environments, proxies)
  • SidecarClient -- Local WebSocket client for browser control (DOM actions, mirror input, navigation)
  • launch_chrome -- Chrome process launcher with gost proxy tunnel
  • Utilities -- Path resolution, free port detection, GPU detection

Installation

bash
pip install https://pub-69fcb37602174d10b2152f09439de470.r2.dev/sdk/linege_sdk-0.2.0-py3-none-any.whl

For development:

bash
cd packages/linege-sdk-python
pip install -e ".[dev]"

Quick Start

Token Auth

python
from linege_sdk import LinegeApi

api = LinegeApi(api_url="https://api.sybilslayer.com", token="YOUR_TOKEN")

profile = api.get_user_profile()
print(f"{profile.user.username}: {profile.quota.remaining} envs remaining")

env = api.create_environment(country="JP", name="demo")
print(f"Created: {env.env_id}, proxy: {env.proxy}")

Username/Password Auth

python
from linege_sdk import LinegeApi

api = LinegeApi.from_login("https://api.sybilslayer.com", "alice", "secret123")

Sidecar (Browser Control)

python
from linege_sdk import SidecarClient

with SidecarClient("ws://127.0.0.1:7788/chrome") as sc:
    sc.register(env_id)
    sc.navigate("https://example.com")
    sc.dom_click("input[name='q']")
    sc.dom_input("input[name='q']", "hello from python sdk")
    sc.dom_scroll(delta_y=300)
    html = sc.dump_html()

API Reference

LinegeApi

MethodDescription
LinegeApi(api_url, token, timeout=20)Constructor (token auth)
LinegeApi.from_login(api_url, username, password)Constructor (login auth)
login(username, password) -> LoginResponseLogin and auto-set token
get_health() -> HealthResponseService health check
get_countries() -> CountriesResponseAvailable countries
get_version() -> VersionResponseClient version info
get_user_profile() -> UserProfileResponseCurrent user profile + quota
create_environment(country, name?, platform?, note?) -> CreateEnvResponseCreate browser environment
get_environment(env_id, auto_heal_proxy=True) -> EnvDetailGet environment details
list_environments(page=1, limit=20) -> EnvListResponseList environments
delete_environment(env_id) -> DeleteEnvResponseDelete environment
refresh_proxy(env_id, reason?) -> RefreshProxyResponseRefresh proxy
report_proxy_dead(env_id, consecutive_failures=1, reason?) -> ReportProxyDeadResponseReport dead proxy

SidecarClient

MethodDescription
SidecarClient(url, timeout=10)Constructor
connect()Connect to sidecar WebSocket
close()Disconnect
register(env_id)Register browser with env ID
set_mirror_mode(enabled)Enable/disable mirror mode
claim_master(bounds?)Claim master role
send_input(input_payload)Send raw input event
send_resize(payload)Send resize event
dom_click(selector, x?, y?)Click element by selector
dom_input(selector, value)Set input value
dom_focus(selector)Focus element
dom_scroll(delta_x=0, delta_y=0, selector?)Scroll page/element
dump_html(max_nodes=500)Dump page HTML
dump_axtree(max_items=200)Dump accessibility tree
navigate(url)Navigate to URL
eval_script(script)Evaluate JavaScript
press_sequentially(selector, text, delay_ms=50)Type text char-by-char
auto_click/auto_input/auto_scroll/auto_navigate/auto_evalAuto-prefixed aliases
on_message(handler)Register message callback

Launcher

FunctionDescription
launch_chrome(env_detail, data_dir?, chrome_path?, sidecar_port?) -> LaunchResultLaunch Chrome with gost tunnel
stop_process_tree(pid)Kill process tree

Utilities

FunctionDescription
get_free_port() -> intFind available TCP port
resolve_chrome_path() -> strLocate Chrome binary
resolve_data_dir() -> strLocate data directory
resolve_gost_path() -> strLocate gost binary

Types

TypeKey Fields
LoginResponsetoken, user: UserInfo, quota: Quota
UserProfileResponseuser: UserInfo, quota: Quota, stats: UserStats
CreateEnvResponseenv_id, country, proxy, quota_remaining, profile
EnvDetailextends CreateEnvResponse + name, status, created_at
EnvListResponseenvironments: List[EnvListItem], pagination: Pagination
DeleteEnvResponsemessage
RefreshProxyResponseenv_id, country, proxy
ReportProxyDeadResponsemessage, new_proxy
HealthResponsestatus, timestamp
CountriesResponsecountries: List[CountryInfo]
VersionResponseversions: Dict[str, VersionInfo]
ProfileConfigprofile_id, env_id, enabled_modules, base, hooks

Environment Variables

VariableDescriptionDefault
API_BASELinege API base URLhttps://api.sybilslayer.com
API_TOKENBearer token(none)
LINEGE_USERNAMEUsername for login auth(none)
LINEGE_PASSWORDPassword for login auth(none)

Examples

bash
# Full CRUD workflow
python examples/example_full.py --api-url https://api.sybilslayer.com --username alice --password secret

# With token
python examples/example_full.py --token YOUR_TOKEN

# Group control E2E
python examples/real_group_control_e2e.py

# Google search flow E2E
python examples/real_google_flow_e2e.py

Notes

  • api_url accepts both https://host and https://host/api/v1 (auto-normalized).
  • Default request timeout is 20s, configurable via timeout parameter.
  • All API calls produce structured JSON logs with trace_id and timing.
  • The SDK is typed (PEP 561 py.typed marker included).

Linege Anti-Browser Documentation