Metadata-Version: 2.4
Name: ditto-sdk
Version: 0.1.0
Summary: Python client for the ditto ephemeral database copy service
License-Expression: MIT
Project-URL: Homepage, https://github.com/attaradev/ditto/tree/main/sdk/python
Project-URL: Repository, https://github.com/attaradev/ditto
Project-URL: Issues, https://github.com/attaradev/ditto/issues
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Provides-Extra: pytest
Requires-Dist: pytest>=7; extra == "pytest"

# ditto Python SDK

Python client for provisioning ephemeral database copies from a running ditto server.

## Install

```bash
pip install "ditto-sdk[pytest]"
```

## Usage

```python
from ditto import Client

client = Client(
    server_url="http://ditto.internal:8080",
    token="secret",
    ttl_seconds=600,
)

copy = client.create()
print(copy["connection_string"])
client.destroy(copy["id"])
```

Use the context manager for automatic cleanup:

```python
from ditto import Client

client = Client(server_url="http://ditto.internal:8080")

with client.with_copy() as dsn:
    print(dsn)
```

## Environment variables

`Client` reads these variables by default:

- `DITTO_SERVER_URL`
- `DITTO_TOKEN`
- `DITTO_TTL`
