Skip to content
/ gios Public

Python wrapper for getting air quality data from GIOŚ

License

Notifications You must be signed in to change notification settings

bieniu/gios

Repository files navigation

GitHub Release PyPI PyPI - Downloads Buy me a coffee PayPal_Me

gios

Python wrapper for getting air quality data from GIOŚ (Główny Inspektorat Ochrony Środowiska)

How to find station_id

How to use package

"""Example for GIOS."""
import asyncio
import logging

from aiohttp import ClientError, ClientSession

from gios import ApiError, Gios, InvalidSensorsData, NoStationError

GIOS_STATION_ID = 568

logging.basicConfig(level=logging.DEBUG)


async def main() -> None:
    """Run main function."""
    async with ClientSession() as websession:
        gios = Gios(GIOS_STATION_ID, websession)
        try:
            data = await gios.async_update()
        except (ApiError, NoStationError, InvalidSensorsData, ClientError) as error:
            print(error)
            return

    latitude = gios.latitude
    longitude = gios.longitude
    station_name = gios.station_name
    print(f"Longitude: {longitude}")
    print(f"Latitude: {latitude}")
    print(f"Station name: {station_name}")
    print(data)


loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()