Metadata-Version: 2.4
Name: flexinfer-browser-kit
Version: 0.2.1
Summary: Production-ready Playwright wrapper with stealth and session management
Author-email: Cody Blevins <cody@flexinfer.ai>
License: MIT
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.11
Requires-Dist: filelock>=3.13.0
Requires-Dist: playwright>=1.40.0
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pre-commit>=3.5.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: stealth
Requires-Dist: playwright-stealth>=1.0.6; extra == 'stealth'
Description-Content-Type: text/markdown

![Banner](assets/banner.png)
# flexinfer-browser-kit

![Header](assets/header.svg)

[![pipeline status](https://gitlab.flexinfer.ai/libs/py-browser-kit/badges/main/pipeline.svg)](https://gitlab.flexinfer.ai/libs/py-browser-kit/-/commits/main)
[![coverage report](https://gitlab.flexinfer.ai/libs/py-browser-kit/badges/main/coverage.svg)](https://gitlab.flexinfer.ai/libs/py-browser-kit/-/commits/main)

Production-ready browser automation library for Python, built on Playwright. Features advanced stealth evasion techniques and robust session management.

## Features

- **Stealth Mode**: Pre-configured evasion scripts to bypass bot detection (custom args, JS injection).
- **Session Management**: persistent context storage with file locking for safe concurrency.
- **Resilience**: Configurable timeouts, proxy support, and automatic retries.

## Installation

```bash
pip install flexinfer-browser-kit
# For stealth features
pip install "flexinfer-browser-kit[stealth]"
```

## Usage

### Basic Scraping

```python
from browser_kit import BrowserManager

manager = BrowserManager(headless=True)

with manager.new_context() as context:
    page = context.new_page()
    page.goto("https://network-tools.com/request")
    print(page.title())
```

### Stealth Mode

```python
from browser_kit import BrowserManager

# Uses custom args and evasion scripts by default
manager = BrowserManager(
    headless=True,
    stealth=True,  # Enable evasion
    user_agent="Mozilla/5.0..."
)

with manager.new_context() as context:
    page = context.new_page()
    page.goto("https://bot-detection-check.com")
```

### Persistent Sessions

```python
manager = BrowserManager(storage_dir="./sessions")

# Automatically loads/saves cookies to ./sessions/my-session.json
context = manager.new_context(session_id="my-session")
```
