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.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-0.1.0.tar.gz
(3.5 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-0.1.0.tar.gz.
File metadata
- Download URL: cosmos_client-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd345bb71f4ee89e15db954ca8b9b3ba4fb7ab188795e427f10bfee619fca8f0
|
|
| MD5 |
512fda335fefaaebf12fca6edc4664a5
|
|
| BLAKE2b-256 |
16ab6d6303f7438caa54eedae349ec27b1c5c5eef650af57612765c1a2618906
|
File details
Details for the file cosmos_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cosmos_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 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 |
bf0b09ae988bc5815bf87080008535172eb19a0bc7d1805d0edf6cc14c7ace12
|
|
| MD5 |
6c92fa87f21d4c1494fb9c9cb5d8d14a
|
|
| BLAKE2b-256 |
45087bb4b97f0d5742cc6dd3bb6b2ed76711c89ae050687b141cd08e678099c4
|