Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mib1185 authored Jul 21, 2023
1 parent bbce199 commit 39e3e24
Showing 1 changed file with 63 additions and 1 deletion.
64 changes: 63 additions & 1 deletion README.md
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)

0 comments on commit 39e3e24

Please sign in to comment.