Metadata-Version: 2.4
Name: streamstraight-server
Version: 0.1.0
Summary: Python server SDK for streaming data into Streamstraight.
Author-email: Streamstraight <support@streamstraight.com>
License: MIT
Project-URL: Homepage, https://www.streamstraight.com
Project-URL: Documentation, https://docs.streamstraight.com
Project-URL: Repository, https://github.com/streamstraight/streamstraight
Project-URL: Issues, https://github.com/streamstraight/streamstraight/issues
Keywords: streaming,socket.io,websockets,sdk,llm,streamstraight
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: httpx<0.29,>=0.27
Requires-Dist: aiohttp>=3.9
Requires-Dist: python-socketio<6,>=5.11.0
Requires-Dist: anyio>=4.0
Requires-Dist: typing-extensions>=4.8; python_version < "3.11"

# Streamstraight Python SDK

`streamstraight-server` mirrors the `@streamstraight/server` Node SDK for producers who prefer Python. It connects to Streamstraight over Socket.IO, manages chunk acknowledgements, and exposes helpers for minting client JWTs.

## Quickstart

```bash
uv add streamstraight-server
```

For local development inside this monorepo, run `uv sync --all-extras` from `packages/python`.

## Usage

```python
import asyncio
from streamstraight_server import streamstraight_server

async def main() -> None:
    server = await streamstraight_server(
        {"api_key": "YOUR_STREAMSTRAIGHT_API_KEY"},
        {"stream_id": "your-stream-id"},
    )

    async def generate():
        # Replace with your LLM or other async generator
        yield {"content": "first chunk"}
        yield {"content": "second chunk"}

    await server.stream(generate())

asyncio.run(main())
```

### Mint a client JWT for your browser client

```python
from streamstraight_server import fetch_client_token

token = await fetch_client_token({"api_key": "YOUR_STREAMSTRAIGHT_API_KEY"})
```
