Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

lotse-client

Async Python client for the control API of lotse, the media daemon for RTSP cameras and WebRTC viewers. It speaks the API over the daemon's Unix socket with aiohttp; the payload types are frozen dataclasses decoded with mashumaro.

from lotse_client import LotseClient
from lotse_client.models import SourceSpec

async with LotseClient("/run/lotse/lotse.sock") as client:
    await client.stream.put(stream_id="front", sources=[SourceSpec(url="rtsp://cam/h264")])
    async with await client.stream.subscribe(stream_id="front") as events:
        async for event in events:
            print(event)

Every command is a keyword-only method named after it: stream/put is client.stream.put(...), session/close is client.session.close(...), and a command without a slash (ping, info, schema, unsubscribe) is a method of the client. A command that subscribes (stream.subscribe, webrtc.offer, session.adopt) returns a Subscription: an async iterator of its events, which ends after a session's closed event or on unsubscribe. A failed command raises CommandError with the stable error code.

Generated code

src/lotse_client/models.py is generated by datamodel-code-generator from the daemon's JSON Schema bundle (../schema/api.json, copied from lotse's crates/lotse-api-types/schema/api.json, which is itself generated from the Rust types); its options are in pyproject.toml. src/lotse_client/_commands.py is then generated by scripts/generate_commands.py from the bundle and those models: each command's fields and their types come from its generated command class, its result type and whether it subscribes from the bundle's results and events. Do not edit either: change the Rust types in lotse, then copy the bundle and regenerate with

mise run schema    # from the repository root; or, here,
uv run datamodel-codegen && uv run python scripts/generate_commands.py

The python-client hook fails when either is stale, and tests/test_commands.py checks the generator's output and what it refuses.

Development

uv sync
uv run pytest       # contract tests too when LOTSE_BIN names a lotse binary built with source-fake (`mise run contract`)
uv run ruff check && uv run ruff format --check && uv run mypy

Metadata

Release files for lotse-client 0.0.0.dev0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lotse-client 0.0.0.dev0
File Size Uploaded
lotse_client-0.0.0.dev0.tar.gz 23.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lotse-client 0.0.0.dev0
File Interpreter ABI Platform
lotse_client-0.0.0.dev0-py3-none-any.whl Python 3 none any Details

Total release size: 50.3 kB

Release files / lotse_client-0.0.0.dev0.tar.gz

Download URL lotse_client-0.0.0.dev0.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
68f3cbe6e77e1f7920daa80a3414f55d2dbf92de83e5136dc7754db1eb7469a8
BLAKE2b-256 checksum
How to use checksums
70478a30612ac4f0656b825133d60ceb7579dc10ca9c5daedf06ed65030d4a16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / lotse_client-0.0.0.dev0-py3-none-any.whl

Download URL lotse_client-0.0.0.dev0-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ac313f2436a6dc8377d78b75e2b81e8a18d59abec20b0ec540b19217a3ee693
BLAKE2b-256 checksum
How to use checksums
f6f5581b6ad13a432f6c27fdcfd79f9378f2784becbaaaf7e685a3223a76f5d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.0.0.dev0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page