-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,64 @@ | ||
[![Test](https://github.com/mib1185/aiopegelonline/actions/workflows/test.yml/badge.svg)](https://github.com/mib1185/aiopegelonline/actions/workflows/test.yml) | ||
[![Library version](https://img.shields.io/pypi/v/aiopegelonline.svg)](https://pypi.org/project/aiopegelonline) | ||
[![Supported versions](https://img.shields.io/pypi/pyversions/aiopegelonline.svg)](https://pypi.org/project/aiopegelonline) | ||
[![Downloads](https://pepy.tech/badge/aiopegelonline)](https://pypi.org/project/aiopegelonline) | ||
[![Formated with Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) | ||
|
||
# aiopegelonline | ||
Asynchronous library to retrieve data from PEGELONLINE | ||
|
||
Asynchronous library to retrieve data from [PEGELONLINE](https://www.pegelonline.wsv.de/). | ||
|
||
## Requirements | ||
|
||
- Python >= 3.9 | ||
- aiohttp | ||
|
||
## Installation | ||
|
||
```bash | ||
pip install aiopegelonline | ||
``` | ||
|
||
## Examples | ||
### Get all available measurement stations | ||
|
||
```python | ||
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 | ||
|
||
```python | ||
import asyncio | ||
import aiohttp | ||
from aiopegelonline import PegelOnline | ||
|
||
|
||
async def main(): | ||
async with aiohttp.ClientSession() as session: | ||
pegelonline = PegelOnline(session) | ||
measurement = await pegelonline.async_get_station_measurement("70272185-b2b3-4178-96b8-43bea330dcae") | ||
print(f"current water level: {measurement.value} {measurement.uom}") | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) | ||
``` | ||
|
||
## References | ||
|
||
- [PEGELONLINE api reference (German)](https://www.pegelonline.wsv.de/webservice/dokuRestapi) |