Python
The Chirpier SDK for Python is a simple, lightweight, and efficient SDK to emit event data to Chirpier direct from your Python applications.
Installation
Install Chirpier SDK using pip:
pip install chirpier
Getting Started
To start using the SDK, you need to initialize it with your API key.
Here’s a quick example of how to use Chirpier SDK:
from chirpier import Chirpier, Event
# Initialize the client
Chirpier.initialize(api_key="your-api-key", region="us-west")
# Monitor the event
try:
Chirpier.monitor(Event(
group_id="bfd9299d-817a-452f-bc53-6e154f2281fc",
stream_name="My measurement",
value=1
))
except (ConnectionError, HTTPError) as e:
print(f"Failed to send event: {e}")
API Reference
Initialize
Initialize the Chirpier client with your API key and region. Find your API key in the Chirpier Integration page.
Chirpier.initialize(api_key="your-api-key", region="us-west")
your-api-key
(str): Your Chirpier integration keyregion
(str): Your local region - options areus-west
,eu-west
,asia-southeast
Event
All events emitted to Chirpier must have the following properties:
event = Event(
group_id="bfd9299d-817a-452f-bc53-6e154f2281fc",
stream_name="My measurement",
value=1
)
group_id
(str): UUID of the monitoring groupstream_name
(str): Name of the measurement streamvalue
(float): Numeric value to record
Emit
Send an event to Chirpier using the monitor
function.
Chirpier.monitor(event)
Last updated on