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
Metadata
Release files for imgw-pib 2.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| imgw_pib-2.5.2.tar.gz | 32.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| imgw_pib-2.5.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.7 kB
Release files / imgw_pib-2.5.2.tar.gz
| Download URL | imgw_pib-2.5.2.tar.gz |
|---|---|
| Size | 32.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9dd1554bfbd207e314d47ba8231a4475d12efa4070ca07d3765e1dae80a2eab9
|
|
BLAKE2b-256 checksum How to use checksums |
48bc0713ea13340c9a57aa2908769e96ce535adf6c5407732850d20d0987c6f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency logRelease files / imgw_pib-2.5.2-py3-none-any.whl
| Download URL | imgw_pib-2.5.2-py3-none-any.whl |
|---|---|
| Size | 28.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b4df61b33ceffeec6c7ab0830267edfaee63f47b69df56f6f3dd8d90096064c8
|
|
BLAKE2b-256 checksum How to use checksums |
dd6ccf706be953b614e23aca5bb51d7995356add06cfecb3771eebef2c3e94b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency log