Skip to main content

Async client for Televic CoCon conference API

Project description

release

Televic CoCon Client

An asynchronous Python client for interacting with the Televic CoCon REST API.

This library provides a type-safe interface for communicating with a Televic CoCon server. It supports long-polling for event notifications, command dispatching with automatic retries and clean shutdown of background tasks.


✨ Features

  • Async-friendly with async with support
  • Long-polling notification handling
  • Automatic command retries with exponential backoff
  • Configurable behaviour (timeouts, polling interval, retries)
  • Typed and documented public API
  • Minimal external dependencies

📦 Installation

The project requires Python 3.11+.

pip install cocon_client

To work on the library locally:

git clone https://github.com/MarcoMiano/cocon_client.git
cd cocon_client
pip install -e .

🚀 Usage

Creating a client and subscribing to models

import asyncio
from cocon_client import CoConClient, Model

async def handle_notification(data: dict) -> None:
    print("Received:", data)

async def main() -> None:
    async with CoConClient("192.168.1.100", handler=handle_notification) as client:
        await client.subscribe([Model.DELEGATE, Model.MICROPHONE])
        await asyncio.sleep(10)

asyncio.run(main())

Sending commands

Commands are queued and retried automatically:

response = await client.send("SomeCommand", {"param": "value"})

Parsing raw notifications

The helper parse_notification converts raw payloads into typed data classes defined in parser.py:

from cocon_client import parse_notification, Delegates

async def handle_notification(data: dict) -> None:
    model = parse_notification(data)
    if isinstance(model, Delegates):
        print("Delegates:", model.delegates)

⚙️ Configuration

You can override default behaviour using the Config dataclass:

from cocon_client import Config, CoConClient

custom_config = Config(
    poll_interval=2.0,
    max_retries=10,
    session_timeout=10.0,
)

client = CoConClient("host", config=custom_config)

🧰 Contributing

See CONTRIBUTING.md for guidelines on how to report issues, submit patches and extend the parser with new models.


📄 License

This project is licensed under the GNU AGPL v3 or later. See LICENSE for details.


Disclaimer

See NOTICE.md for disclaimers regarding Televic CoCon.


🛠 Maintainers

Developed and maintained by 3P Technologies Srl.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cocon_client-0.2.3.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cocon_client-0.2.3-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file cocon_client-0.2.3.tar.gz.

File metadata

  • Download URL: cocon_client-0.2.3.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cocon_client-0.2.3.tar.gz
Algorithm Hash digest
SHA256 e12cd790a25e910bc74719afbf41f7ed191401e7ceaa63594de92d4ab622d470
MD5 0c48e51e0f01f04efb084e5263dc3d86
BLAKE2b-256 8892f31608dc096c3e0c093cfcd8b1652d62ecc86e0aea13454bc79577708a4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cocon_client-0.2.3.tar.gz:

Publisher: release.yml on MarcoMiano/cocon_client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cocon_client-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: cocon_client-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cocon_client-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aae4ffc0d93285ea91705687999927e90ed9707fc9cace9c4b4c71a704270f88
MD5 74c8382b3b08ba30d847d35af7a9c340
BLAKE2b-256 8d79d8f0efecbc179f220a24421297c28fc630ed5c63c3be9006c69b77eac655

See more details on using hashes here.

Provenance

The following attestation bundles were made for cocon_client-0.2.3-py3-none-any.whl:

Publisher: release.yml on MarcoMiano/cocon_client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page