Metadata-Version: 2.4
Name: livqeno-sdk
Version: 0.1.0
Summary: Official Python SDK for the Raven hosted platform — mint short-lived RTC tokens, manage rooms, and read connection/error diagnostics from your own backend. Never for use in a browser.
License: MIT
Project-URL: Homepage, https://github.com/atulsinghhhh/Raven
Project-URL: Documentation, https://github.com/atulsinghhhh/Raven/blob/main/docs/sdk/server/python.md
Project-URL: Repository, https://github.com/atulsinghhhh/Raven
Project-URL: Issues, https://github.com/atulsinghhhh/Raven/issues
Keywords: webrtc,rtc,chat,live-streaming,sdk,livqeno
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.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx<1.0,>=0.28.1
Provides-Extra: dev
Requires-Dist: pytest>=9.1.1; extra == "dev"
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
Requires-Dist: mypy>=2.3.1; extra == "dev"
Requires-Dist: ruff>=0.16.6; extra == "dev"
Requires-Dist: build>=1.6.0; extra == "dev"
Dynamic: license-file

# livqeno-sdk

Livqeno's official **Python server SDK** — mint short-lived RTC and chat
tokens, manage rooms and live streams, and read connection/error
diagnostics from your own backend.

Livqeno is a managed real-time infrastructure platform: video, voice, chat
and live streaming for your app, without running WebRTC or WebSocket
servers yourself. Learn more: <https://livqeno.com>

> **Backend only.** This package holds a permanent project API key. It must
> never be imported into browser, mobile or any other client-side code. The
> browser talks to Livqeno with a short-lived token that *this* SDK mints.

## Requirements

- Python **3.10+**
- A Livqeno project API key

## Install

```bash
# Not on PyPI yet — see docs/releases.md#python--livqeno-sdk.
pip install "git+https://github.com/atulsinghhhh/Raven.git#subdirectory=sdks/python"
```

Once published: `pip install livqeno-sdk`. The importable module stays
`raven` either way — `from raven import Raven`.

## Mint a token

Identity comes from *your* session — never from the request body, or any
caller can claim to be anyone.

```python
import os
from raven import Raven, CreateTokenParams

raven = Raven(
    api_key=os.environ["RAVEN_API_KEY"],
    base_url=os.environ["RAVEN_API_URL"],  # https://api.ravenstack.online
)

grant = raven.tokens.create(CreateTokenParams(room="room-1", identity="user-42"))

# grant is a TypedDict, keyed exactly as the API returns it:
#   grant["token"]        short-lived, safe to hand to a browser
#   grant["endpoint"]     Livqeno's signaling WebSocket
#   grant["iceServers"]   never hand-build STUN/TURN config
#   grant["expiresAt"]
```

Hand `grant` to your frontend, which passes it to `@ravenkash/rtc`. See
[docs/sdk.md](https://github.com/atulsinghhhh/Raven/blob/main/docs/sdk.md).

## Async

Every resource has an async twin with the same shape.

```python
from raven import AsyncRaven, CreateTokenParams

async with AsyncRaven(
    api_key=os.environ["RAVEN_API_KEY"],
    base_url=os.environ["RAVEN_API_URL"],  # https://api.ravenstack.online
) as raven:
    grant = await raven.tokens.create(CreateTokenParams(room="room-1", identity="user-42"))
```

## Resources

`tokens` · `rooms` · `projects` · `connections` · `errors` · `diagnostics`
· `metrics` · `chat` · `live_streams`

## Errors

Every non-2xx response and every transport failure raises `RavenError`,
carrying the API's error code and HTTP status so you can branch on the
cause rather than parse a message. It is built only from the parsed error
body and response metadata, so it can never carry your API key.

```python
from raven import Raven, RavenError

try:
    raven.rooms.get("no-such-room")
except RavenError as err:
    print(err.code, err.status_code, err.request_id)
```

Codes are listed in
[docs/error-codes.md](https://github.com/atulsinghhhh/Raven/blob/main/docs/error-codes.md).

## Documentation

- [Python server SDK reference](https://github.com/atulsinghhhh/Raven/blob/main/docs/sdk/server/python.md)
- [Server SDK security model](https://github.com/atulsinghhhh/Raven/blob/main/docs/security/server-sdk.md)
- [Runnable example](https://github.com/atulsinghhhh/Raven/tree/main/examples/python-server)

## Development

From `sdks/python/`:

```bash
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

ruff format --check .    # formatting
ruff check .             # lint
mypy src                 # strict type check
pytest                   # tests
python -m build          # sdist + wheel
```

CI runs all of the above against Python 3.10–3.13 on every pull request
(`.github/workflows/ci.yml`).

## License

MIT — see [LICENSE](https://github.com/atulsinghhhh/Raven/blob/main/LICENSE).
