Skip to main content

CI codecov GitHub Release PyPI PyPI - Downloads Buy me a coffee PayPal_Me Revolut.Me

imgw-pib

Python async wrapper for IMGW-PIB API.

Installation

You can install the library with pip:

pip install imgw-pib

How to use the library

"""Example of usage IMGW-PIB."""

import asyncio
import logging

from aiohttp import ClientError, ClientSession

from imgw_pib import ApiError, ImgwPib

logging.basicConfig(level=logging.DEBUG)

WEATHER_STATION_ID = "12200"
HYDROLOGICAL_STATION_ID = "154190050"


async def main() -> None:
    """Run main function."""
    async with ClientSession() as websession:
        try:
            imgwpib = await ImgwPib.create(
                websession,
                weather_station_id=WEATHER_STATION_ID,
                hydrological_station_id=HYDROLOGICAL_STATION_ID,
            )
            weather_data = await imgwpib.get_weather_data()
            hydrological_data = await imgwpib.get_hydrological_data()
        except ApiError as error:
            print(f"API Error: {error.status}")
        except ClientError as error:
            print(f"ClientError: {error}")
        except TimeoutError as error:
            print(f"TimeoutError: {error}")
        else:
            print(f"Weather stations: {imgwpib.weather_stations}")
            print(f"Weather data: {weather_data}")
            print(f"Hydrological stations: {imgwpib.hydrological_stations}")
            print(f"Hydrological data: {hydrological_data}")


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

Error handling

The library raises ApiError when the IMGW-PIB API returns an error, ClientError for network-related errors, and TimeoutError when a request times out.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

How to create a dev environment

git clone https://github.com/bieniu/imgw-pib.git
cd imgw-pib
./scripts/setup-local-env.sh

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imgw_pib-2.5.1.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imgw_pib-2.5.1-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file imgw_pib-2.5.1.tar.gz.

File metadata

  • Download URL: imgw_pib-2.5.1.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for imgw_pib-2.5.1.tar.gz
Algorithm Hash digest
SHA256 de07c9ae6194259a113e58586da0130b4d2d8b9516425323d374739266950bd6
MD5 7bb8c4b97f45614730d1fd96a6895749
BLAKE2b-256 487beaf9d15fb513eaf612665dd2b290e5378b62f55c6386049f1e1f49efd554

See more details on using hashes here.

Provenance

The following attestation bundles were made for imgw_pib-2.5.1.tar.gz:

Publisher: publish.yml on bieniu/imgw-pib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file imgw_pib-2.5.1-py3-none-any.whl.

File metadata

  • Download URL: imgw_pib-2.5.1-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for imgw_pib-2.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 230d8a3a7f00ea9d965ac41ccaf26ddc7a5a4429c7efd435c6d0f7f9f2bae527
MD5 fd6e5003e02fc40f383bb2cd76ca7d69
BLAKE2b-256 382effc1f1c5fa80b0ffc9059ea3a98f03671284628563deedb31bb0bde8cfdc

See more details on using hashes here.

Provenance

The following attestation bundles were made for imgw_pib-2.5.1-py3-none-any.whl:

Publisher: publish.yml on bieniu/imgw-pib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

2.5.1 This release

2 files

2.5.0

2 files

2.4.3

2 files

2.4.2

2 files

2.4.1

2 files

2.4.0

2 files

2.3.0

2 files

2.2.2

2 files

2.2.1

2 files

2.2.0

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.6.1

2 files

1.6.0

2 files

1.5.6

2 files

1.5.5

2 files

1.5.4

2 files

1.5.3

2 files

1.5.2

2 files

1.5.1

2 files

1.5.0

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.10

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.0.5

2 files

0.0.1

2 files

0.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page