mirror of
https://github.com/jdejaegh/irm-kmi-api.git
synced 2025-06-26 20:05:40 +02:00
Update README code example
This commit is contained in:
parent
2b7fbcf1d5
commit
2eb9434fb9
1 changed files with 5 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
# Async API to retrieve data from the Belgian IRM KMI in Python
|
||||
|
||||
The package exposes the data from the [mobile application of the Belgian IRM KMI](https://www.meteo.be/en/info/faq/products-services/the-rmi-weather-app) as a python module.
|
||||
The package exposes the data from the [mobile application of the Belgian IRM KMI](https://www.meteo.be/en/info/faq/products-services/the-rmi-weather-app) as a Python module.
|
||||
|
||||
See more information in the wiki: https://github.com/jdejaegh/irm-kmi-api/wiki
|
||||
|
||||
|
@ -14,15 +14,16 @@ from irm_kmi_api import IrmKmiApiClientHa
|
|||
|
||||
async def print_weather():
|
||||
session = aiohttp.ClientSession()
|
||||
client = IrmKmiApiClientHa(session=session, user_agent="jdejaegh/irm-kmi-api README example", cdt_map={})
|
||||
client = IrmKmiApiClientHa(session=session, user_agent="jdejaegh/irm-kmi-api README example")
|
||||
await client.refresh_forecasts_coord({'lat': 50.47, 'long': 4.87})
|
||||
await session.close()
|
||||
|
||||
|
||||
weather = client.get_current_weather(tz=ZoneInfo('Europe/Brussels'))
|
||||
city = client.get_city()
|
||||
|
||||
|
||||
print(f"{weather['temperature']}°C with wind of {weather['wind_speed']} km/h in {city}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(print_weather())
|
||||
```
|
||||
|
|
Loading…
Add table
Reference in a new issue