Query Sensoterra probes using the Customer API
Project description
Sensoterra
Package to retrieve Sensoterra probe data by polling the Sensoterra Customer API using async/await.
Example code
When the email and password are always available:
import time
import asyncio
from sensoterra.customerapi import CustomerApi
async def main(email, password):
api = CustomerApi(email, password)
api.set_language("en")
while True:
api.poll()
for probe in api.probes():
print(probe)
for sensor in probe.sensors():
print(sensor)
print()
time.sleep(900)
print('-' * 70)
asyncio.run(main("me@example.com", "secret"))
Otherwise request a authentication token:
from datetime import datetime
async def get_token(email, password):
api = CustomerApi(email, password)
api.set_language("en")
tag = "My Application"
scope = "READONLY"
expiration = datetime(2038, 1, 1, 0, 0)
token = await api.get_token(tag, scope, expiration)
And use this token:
async def main(email, password):
token = await get_token(email, password)
api = CustomerApi()
api.set_language("en")
api.set_token(token)
while True:
probes = await api.poll()
for probe in probes:
print(probe)
for sensor in probe.sensors():
print(sensor)
print()
time.sleep(900)
print('-' * 70)
Changelog
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sensoterra-2.0.1.tar.gz
(7.1 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 sensoterra-2.0.1.tar.gz.
File metadata
- Download URL: sensoterra-2.0.1.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59f8d33a7b3938f53cfae7c37857431a351184159415fc3fa9148741acc12f4e
|
|
| MD5 |
33af1024e581f027af9382a01a06904e
|
|
| BLAKE2b-256 |
7b86a62eb7206173faca0974dc1f195b2400b49b5d0f0bf4141541c8b4189086
|
File details
Details for the file sensoterra-2.0.1-py3-none-any.whl.
File metadata
- Download URL: sensoterra-2.0.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b25e6a9276e1f7e71efeed41c91e326e832bb021b5d2c0532fee6dbda5c73120
|
|
| MD5 |
f99e36060d7a6ab39d3e83a29eaaa0e6
|
|
| BLAKE2b-256 |
340df3b2c3af973860ad0bcb74040dde8e7e38e8740c7ecba7e7f2c462ca14f9
|