Metadata-Version: 2.1
Name: tws-sdk
Version: 0.2.0
Summary: TWS client for Python.
Home-page: https://github.com/Fireline-Science/tws-py
License: MIT
Author: Fireline Science
Author-email: sean@firelinescience.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
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: Programming Language :: Python :: 3.13
Requires-Dist: httpx[http2] (>=0.26,<0.29)
Project-URL: Documentation, https://github.com/Fireline-Science/tws-py
Project-URL: Repository, https://github.com/Fireline-Science/tws-py
Description-Content-Type: text/markdown

# `tws-sdk`

Python client for [TWS](https://www.tuneni.ai).

## Installation

```bash
pip install tws-sdk
```

## Usage

The library provides both synchronous and asynchronous clients for interacting with TWS.

The primary API is `run_workflow`, which executes a workflow configured via the TWS UI, waits for completion,
and returns the result.

### Synchronous Usage

```python
from tws import Client as TWSClient

# Use the client with a context manager
with TWSClient(
    public_key="your_public_key",
    secret_key="your_secret_key",
    api_url="your_api_url"
) as tws_client:
    # Run a workflow and wait for completion
    result = tws_client.run_workflow(
        workflow_definition_id="your_workflow_id",
        workflow_args={
            "param1": "value1",
            "param2": "value2"
        },
    )
```

### Asynchronous Usage

The signatures are exactly the same for async usage, but the client class is `TWSAsyncClient` and client
methods are awaited.

```python
from tws import AsyncClient as TWSAsyncClient


async def main():
    # Use the async client with a context manager
    async with TWSAsyncClient(
        public_key="your_public_key",
        secret_key="your_secret_key",
        api_url="your_api_url"
    ) as tws_client:
        # Run a workflow and wait for completion
        result = await tws_client.run_workflow(
            workflow_definition_id="your_workflow_id",
            workflow_args={
                "param1": "value1",
                "param2": "value2"
            },
        )
```

