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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c38daba6c7b7a9c5d4a4cbbc6e46047f6dcc33a4091f00b74bc32ed5ce8103ad
|
|
| MD5 |
85eb4d3c6e4b96a141070de3228d1435
|
|
| BLAKE2b-256 |
814c48d69ae8d8fbc2b64694ac897173c4e15eab9707d2d5254d35793a980c43
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a9b9fb17a7a5197d411d404cfac10606b6de635196aca804d8733399d6adf9e
|
|
| MD5 |
2d4ab5219b13cbe7d3f79a21a0dc8adb
|
|
| BLAKE2b-256 |
34ec3f16dfe59c130dd1d4f8c6eecdb56aaa323df42adf4199c61c01123cdac9
|