Metadata-Version: 2.4
Name: open_data_bz_meteo
Version: 1.0.0a2
Summary: Python API client for the open meteo data V1 service, provided by Provincia autonoma di Bolzano - Informatica Alto Adige SPA.
Author-email: david vnl <io@davole.com>
License-Expression: CC-BY-SA-4.0
Project-URL: Homepage, https://github.com/dvdvnl/open_data_bz_meteo
Project-URL: Issues, https://github.com/dvdvnl/open_data_bz_meteo/issues
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.12.0
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: requests>=2.28
Requires-Dist: pydantic>=2.0
Provides-Extra: develop
Requires-Dist: build>=1.4.0; extra == "develop"
Requires-Dist: pytest-cov>=7.0; extra == "develop"
Requires-Dist: pytest>=7.0; extra == "develop"
Requires-Dist: requests-mock>=1.9.3; extra == "develop"
Requires-Dist: twine>=6.2.0; extra == "develop"
Dynamic: license-file

# Open Data BZ Meteo - API Client

Python API client for the "Open Meteo Data V1" service, provided by _Provincia autonoma di Bolzano - Informatica Alto Adige SPA_. The API documentation can be found [here](https://data.civis.bz.it/dataset/misure-meteo-e-idrografiche).

## Core classes

### `Client`

Main entrypoint to the API.

- `get_stations()` fetches all stations and caches them on the client.
- `get_station(station_code)` looks up a single station by code (refreshes cache).
- `get_sensors(station)` fetches sensors for a given station.
- `get_sensor(station, sensor_type)` fetches a single sensor and raises `ValueError` if not found.

### `Station`

- Represents a station with location data (`latitude`, `longitude`, `altitude`) and localized names (`name_deu`, `name_eng`, `name_ita`, `name_lld`).
- `sensor_types`: sensor types available at this station.
- `get_sensor(sensor_type)`: returns the first matching sensor or `None`.

### `Sensor`

- Represents a single sensor reading with `type`, `unit`, `value`, and `date`.
- `parsed_datetime`: computed `datetime` parsed from the raw `date` string.
- Localized description (`description_deu`, `description_ita`, `description_lld`).

## Usage

```python
from open_data_bz_meteo import Client

client = Client(timeout=5)

# List available stations
stations = client.get_stations()
print(stations[0].name_eng, stations[0].latitude)

# Fetch sensors for a single station
station = stations[0]
station.sensors = client.get_sensors(station)
print([s.type for s in station.sensors])

# Fetch a single sensor by type
sensor = client.get_sensor(station, "WT")
print(sensor.value, sensor.unit)
```
