Apptuit Python Client
Project description
Python client for Apptuit.AI
Installation
pip install apptuit
Usage
Querying for data
In [1]: from apptuit import Apptuit
In [2]: import time
In [3]: token = 'my_token'
In [4]: apptuit = Apptuit(token=token)
In [5]: start_time = int(time.time()) - 3600
In [6]: query_res = apptuit.query("fetch('proc.cpu.percent').downsample('1m', 'avg')", start=start_time)
In [7]: df = query_res[0].to_df()
In [8]: type(df)
Out[8]: pandas.core.frame.DataFrame
In [9]: df.shape
Out[9]: (116, 89)
# Another way of creating the DF is accessing by the metric name in the query
In [7]: another_df = query_res['proc.cpu.percent'].to_df()
Sending data
In [1]: from apptuit import Apptuit, DataPoint
In [2]: import time
In [3]: import random
In [4]: token = "mytoken"
In [5]: client = Apptuit(token=token)
In [6]: metric = "proc.cpu.percent"
In [7]: tags = {"host": "localhost", "ip": "127.0.0.1"}
In [8]: curtime = int(time.time())
In [9]: dps = []
In [10]: for i in range(10000):
...: dps.append(DataPoint(metric, tags, curtime + i * 60, random.random()))
...:
In [11]: client.send(dps)
In [12]: dps = []
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
apptuit-0.2.2.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for apptuit-0.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a660f3774d2dd49a9a147e0ce7c2f33aea29e68b8f628eac526f189efebd1fc |
|
MD5 | 16d98979fb9bf1b489b375d4dd0359bb |
|
BLAKE2b-256 | 9855c6420f2ba61b1bb5c1997bba4970f6cb0b1c324ef10d500449052ffc72d2 |