Metadata-Version: 2.4
Name: skope-py
Version: 0.1.3
Summary: Python SDK for the Skope API
Home-page: https://github.com/skope/skope-sdk
Author: Skope
Author-email: Skope <connor@useskope.com>
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.25.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=22.0.0; extra == "dev"
Requires-Dist: isort>=5.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# Skope SDK

A Python SDK for interacting with the Skope API.

## Installation

```bash
pip install skope-sdk
```

## Usage

```python
from skope import Skope, Event

# Initialize the client
client = Skope(
    api_key="your_api_key_here",
    base_url="https://api.useskope.com"  # Optional, defaults to production
)

# Create events for billing
events = [
    Event(
        user_id="customer_123",
        unit="api_calls",
        value=100
    ),
    Event(
        user_id="customer_456", 
        unit="storage_gb",
        value=5
    )
]

# Upload events in batch
result = client.upload_events(events)
print(f"Upload result: {result}")
```

## Error Handling

The SDK will raise HTTP exceptions if API requests fail:

```python
import requests

try:
    result = client.upload_events(events)
except requests.exceptions.HTTPError as e:
    print(f"Failed to upload events: {e}")
except requests.exceptions.RequestException as e:
    print(f"Request failed: {e}")
```

## API Reference

### Skope

#### `__init__(api_key: str, base_url: str = "https://api.useskope.com")`

Initialize a new Skope client.

- `api_key`: Your Skope API key
- `base_url`: The base URL of the Skope API (optional)

#### `upload_events(events: List[Event]) -> Dict[str, Any]`

Upload multiple events for billing in one request.

- `events`: A list of Event objects
- Returns: The response data containing upload status

### Event

A Pydantic model representing a billing event.

#### Fields:

- `user_id`: str (required) - The customer identifier
- `unit`: str (required) - The billing unit name
- `value`: int (optional) - The value to aggregate over
