Skip to main content

cosmos-client

Python client SDK for the Cosmos host application.

Installation

pip install cosmos-client

Usage

from cosmos_client import Client

# Build and send a request
response = Client.Send(Client.Log("Hello from Python"))
print(response.message)

# Get the user name
response = Client.Send(Client.GetUserName())
print(response.message)

API

Request Builders (static methods)

Method Description
Client.Log(content) Create a Log request
Client.Warning(content) Create a Warning request
Client.Error(content) Create an Error request
Client.GetUserName() Create a GetUserName request
Client.MessageBox(name, message) Create a MessageBox request
Client.MessageBar(message, level) Create a MessageBar request
Client.PlayRingtone(audio_path) Create a PlayRingtone request
Client.PlayRingtoneOnce(audio_path) Create a PlayRingtoneOnce request (plays once, no loop)
Client.OpenRegisteredApp(app_name) Create an OpenRegisteredApp request

Serialization Helpers (static methods)

Method Description
Client.CreateRequest(request) Serialize a Request to JSON string
Client.GetResponse(text) Deserialize JSON string to Response
Client.GetResponseMessage(text) Deserialize and extract message

I/O

Method Description
Client.Send(request) Send request via stdout, read response from stdin

Communication Protocol

The client communicates with the Cosmos host via stdin/stdout using JSON:

  • Request: {"request": "Log", "args": ["content"]}
  • Response: {"request": "Log", "message": "reply text"}

Download files

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

Source Distribution

cosmos_client-1.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

cosmos_client-1.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file cosmos_client-1.1.tar.gz.

File metadata

  • Download URL: cosmos_client-1.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for cosmos_client-1.1.tar.gz
Algorithm Hash digest
SHA256 c38daba6c7b7a9c5d4a4cbbc6e46047f6dcc33a4091f00b74bc32ed5ce8103ad
MD5 85eb4d3c6e4b96a141070de3228d1435
BLAKE2b-256 814c48d69ae8d8fbc2b64694ac897173c4e15eab9707d2d5254d35793a980c43

See more details on using hashes here.

File details

Details for the file cosmos_client-1.1-py3-none-any.whl.

File metadata

  • Download URL: cosmos_client-1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for cosmos_client-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2a9b9fb17a7a5197d411d404cfac10606b6de635196aca804d8733399d6adf9e
MD5 2d4ab5219b13cbe7d3f79a21a0dc8adb
BLAKE2b-256 34ec3f16dfe59c130dd1d4f8c6eecdb56aaa323df42adf4199c61c01123cdac9

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1 This release

2 files

0.1.0

2 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