Python SDK
Python SDK
Create and control Lexmount browser sessions from Python.
The lexmount package creates remote browser sessions and exposes sessions, persistent contexts, extensions, downloads, CDP helpers, and region selection through a typed Python API.
Install
pip install --upgrade lexmountRequirements:
- Python 3.8 or later
- Playwright is optional and only required for browser automation
Install Playwright for the examples in this guide:
pip install playwright python-dotenv
playwright install chromiumCurrent capabilities
- asynchronous session creation with activation polling;
- Chromium (
normal) and Moli (light) browser types; - automatic region catalog selection or an explicit region;
- View/inspect URL, CDP connection URL, and page-target discovery;
- persistent context create, list, get, fork, delete, and force release;
- extension upload, list, get, mount, and delete;
- custom or official proxy configuration;
- stored downloads and persistent replay controls;
- custom image and window-size session options;
- structured errors, configurable logs, raw CDP helpers, and opt-in quality reporting.
Configuration
LEXMOUNT_API_KEY=<your-api-key>
LEXMOUNT_PROJECT_ID=<your-project-id>
LEXMOUNT_BASE_URL=https://api.lexmount.cnConstructor arguments override environment variables. LEXMOUNT_BASE_URL is optional and defaults to https://api.lexmount.cn.
Source and examples
Next
- Quick Start: create Chromium and Moli sessions and connect with Playwright.
- Capabilities: current client, session, context, extension, download, and CDP APIs.
- Examples: choose a runnable script by task.
Lexmount Browser