No project description provided
Project description
Comon Python Package
The comon package is a Python library that provides a convenient interface for interacting with the Comon API. This package allows you to create and send status updates, including messages, key performance indicators (KPIs), and various types of charts.
Installation
To install the comon package, use the following command:
pip install comon
Usage
You can find an example including all chart types in the example.py file.
To get started, import the necessary modules and create a Client instance. Replace the URL in Client with the actual Comon API URL.
import comon.api as comon_api
client = comon_api.Client("http://localhost:8080")
Create your status:
import datetime as dt
from comon.models import (
Criticality,
Status,
Kpi,
Chart,
Series,
DataPoint,
ChartType,
VizType,
)
messages = ["Something was detected."]
kpis = [
Kpi(name="Sample KPI 1", value=35, unit="ms"),
Kpi(name="Sample KPI 2", value=22, unit="Watt"),
]
time_based_line_chart = Chart(
title="Time Based Line Chart",
sub_title="Some Subtitle",
type=ChartType.LINE,
series=[
Series(
name="First Series",
viz_type=VizType.PRIMARY,
y_unit="ms",
data_points=[
DataPoint(
time=dt.datetime.now() - dt.timedelta(seconds=5),
y=[3],
),
DataPoint(
time=dt.datetime.now() - dt.timedelta(seconds=3),
y=[5],
),
DataPoint(
time=dt.datetime.now() - dt.timedelta(seconds=1),
y=[4],
),
],
)
],
)
Send the status to Comon:
client.create_status("YOUR_PACKAGE_GUID", status)
You can get the package guid in the edit mode of the asset by clicking on the "Copy Package Guid" button. This requires you to create an external package first.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 comon-0.1.0.tar.gz.
File metadata
- Download URL: comon-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
547bfce23d5a28c60621c161f42aefb09e61ee3284cc99a458dbb1c7d48f1bef
|
|
| MD5 |
fb4e519c828fcb2a22bc084fef4bbde1
|
|
| BLAKE2b-256 |
9adec0ea675d2721b02d8f43b084cc518ac3d5a9f9b270145fbb65f1a959e80a
|
File details
Details for the file comon-0.1.0-py3-none-any.whl.
File metadata
- Download URL: comon-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ac727f12fb277155be71b402c3dafc78d8cfe3db3ba410d9d7c4d841f79eb5a
|
|
| MD5 |
2d8ba020065c2b2339686a011aaa3a87
|
|
| BLAKE2b-256 |
dc33712e61e1275b2a7aa04990c6e6e2b0e98b6bc0556688e8d2b833c35696d8
|