Metadata-Version: 2.4
Name: chetavly
Version: 0.1.0
Summary: Official Python SDK for Chetavly Browser-as-a-Service infrastructure.
Author-email: Justice Nmezi <justice@chetavly.com>
License-Expression: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.24.0
Requires-Dist: pydantic>=2.0.0
Dynamic: license-file

# Chetavly Python SDK

Official Python SDK for the [Chetavly](https://chetavly.com) Browser-as-a-Service infrastructure.

## Installation

```bash
pip install chetavly
```

Or install from source:

```bash
git clone https://github.com/chetavly/chetavly-sdk-python.git
cd chetavly-sdk-python
pip install -e .
```

## Quick Start

```python
from chetavly import ChetavlyClient
from chetavly.schemas.profile import BulkProfileRequest

with ChetavlyClient(api_key="ct_live_your_key_here") as client:
    # Check your balance
    stats = client.billing.get_stats()
    print(stats)

    # Create browser profiles
    request = BulkProfileRequest(
        count=2,
        hardware="standard",
        os="windows",
        region="us-east",
    )
    profiles = client.profiles.create_bulk(data=request)
    print(profiles)

    # Launch a profile
    session = client.profiles.launch(profile_id="<profile_id>")
    print(session)
```

## API Resources

| Resource | Methods |
|---|---|
| `client.profiles` | `list`, `create_bulk`, `launch`, `stream`, `sync_state`, `stop`, `delete` |
| `client.proxies` | `list`, `add`, `delete`, `get_cluster_health`, `run_diagnostic` |
| `client.billing` | `get_stats`, `get_usage_analytics`, `get_history`, `get_daily_spend`, `update_settings` |
| `client.whitelist` | `get_all`, `add`, `remove` |
| `client.automation` | `get_status`, `vault`, `execute`, `revoke` |

## Error Handling

```python
from chetavly.exceptions import (
    AuthenticationError,
    InsufficientFundsError,
    RateLimitError,
    ValidationError,
)

try:
    client.profiles.launch(profile_id="abc123")
except AuthenticationError:
    print("Invalid API key")
except InsufficientFundsError:
    print("Top up your balance")
except RateLimitError:
    print("Slow down - retry after a delay")
```

## Configuration

```python
client = ChetavlyClient(
    api_key="ct_live_...",
    base_url="https://api.chetavly.com",  # default
    timeout=30.0,                          # seconds, default
)
```

## Requirements

- Python >= 3.9
- httpx >= 0.24.0
- pydantic >= 2.0.0

## License

MIT
