Asynchronous library to retrieve data from PEGELONLINE.
Project description
aiopegelonline
Asynchronous library to retrieve data from PEGELONLINE.
:warning: this is in early development state :warning:
breaking changes may occure at every time
Requirements
- Python >= 3.9
- aiohttp
Installation
pip install aiopegelonline
Examples
Get all available measurement stations
import asyncio
import aiohttp
from aiopegelonline import PegelOnline
async def main():
async with aiohttp.ClientSession() as session:
pegelonline = PegelOnline(session)
stations = await pegelonline.async_get_all_stations()
for uuid, station in stations.items():
print(f"uuid: {uuid} name: {station.name}")
if __name__ == "__main__":
asyncio.run(main())
Get current measurement
import asyncio
import aiohttp
from aiopegelonline import PegelOnline
async def main():
async with aiohttp.ClientSession() as session:
pegelonline = PegelOnline(session)
measurements = await pegelonline.async_get_station_measurements("70272185-b2b3-4178-96b8-43bea330dcae")
for name, data in measurements.as_dict().items():
if data is None:
print(f"{name} not provided by measurement station")
else:
print(f"{name}: {data.value} {data.uom}")
if __name__ == "__main__":
asyncio.run(main())
References
You like my work?
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file aiopegelonline-0.0.10-py3-none-any.whl
.
File metadata
- Download URL: aiopegelonline-0.0.10-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e586435d3f7c8f313aa92b7ba19002efc00f0f642508c5a1145a7401d5458435 |
|
MD5 | 180e64370f9b3cfa2f857379e254a8f3 |
|
BLAKE2b-256 | 3694b2a1f44f45d7429e2fdf00ba446b4f5da8e32fa2ecbb5cd251e788980473 |