Metadata-Version: 2.4
Name: lambda_playwright
Version: 0.1.2
Summary: SDK for invoking Lambda Playwright service
Author: Hubexo
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.25.0
Requires-Dist: requests-aws4auth>=1.1.0
Dynamic: author
Dynamic: description
Dynamic: description-content-type
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Lambda Playwright SDK

A Python SDK for interacting with the Lambda Playwright service.

## Installation

```bash
pip install lambda-playwright
```

## Usage

### Initialization

```python
from lambda_playwright import LambdaPlaywright

# Initialize with environment variables (AWS_PLAYWRIGHT_FUNCTION_URL, AWS_PLAYWRIGHT_ACCESS_KEY, AWS_PLAYWRIGHT_SECRET_ACCESS)
client = LambdaPlaywright()

# Or explicitly
client = LambdaPlaywright(
    function_url="https://your-function-url.lambda-url.ap-southeast-1.on.aws",
    access_key_id="your-access-key-id",
    secret_access_key="your-secret-access-key",
    region="ap-southeast-2"
)
```

### Visit a Page

```python
response = client.visit({
    "url": "https://example.com",
    "actions": [
        {"type": "wait_for_selector", "selector": "a"}
    ],
})

print(response["html"])
```

### Render HTML

```python
response = client.render_html({
    "html_content": "<h1>Hello World</h1><script>document.write('Loaded');</script>",
    "actions": [],
    "scroll_to_bottom": True
})

print(response["html"])
```

## Development

To run locally against a local Lambda container:

```python
client = LambdaPlaywright(debug=True)
```
