BrightSky
Type-safe query builders and response types for the Bright Sky API, providing access to German weather data from the Deutscher Wetterdienst (DWD).
Quick Start
With reqwest Extension Trait (Recommended)
The easiest way to use brightsky with reqwest:
[]
= { = "0.2", = ["reqwest"] }
= { = "1", = ["rt-multi-thread", "macros"] }
use ;
async
Manual HTTP Client Usage
If you prefer to handle HTTP yourself:
[]
= "0.2"
= { = "0.13", = ["json"] }
= { = "1", = ["rt-multi-thread", "macros"] }
use ;
async
Examples
Weather Forecast/History
use ;
use NaiveDate;
async
Embedded Usage (no_std)
For embedded systems, use to_url_string() with your HTTP client:
use ;
let query = new
.with_lat_lon
.build?;
// Get URL as String (works in no_std)
let url = query.to_url_string?;
// Use your HTTP client (reqwless, etc.) to fetch, then deserialize
let response: CurrentWeatherResponse = from_slice?;
Query Builders
| Endpoint | Builder | Response Type |
|---|---|---|
/current_weather |
CurrentWeatherQueryBuilder |
CurrentWeatherResponse |
/weather |
WeatherQueryBuilder |
WeatherResponse |
/radar |
RadarWeatherQueryBuilder |
RadarResponse |
/alerts |
AlertsQueryBuilder |
AlertsResponse |
Common Options
- Location:
.with_lat_lon((lat, lon))or.with_dwd_station_id(vec!["01766"]) - Date:
.with_date(date)and.with_last_date(end_date) - Timezone:
.with_tz("Europe/Berlin") - Units:
.with_units(UnitType::Si)or.with_units(UnitType::Dwd)
Feature Flags
| Feature | Description |
|---|---|
std (default) |
Enables url::Url support via to_url() method |
reqwest |
Enables BrightSkyReqwestExt trait for ergonomic reqwest usage |
Without std: Only to_url_string() available (no_std compatible for embedded systems).
Data Sources
All data is sourced from the DWD open data server:
- SYNOP observations: Real-time weather station data
- MOSMIX forecasts: Numerical weather prediction
- Radar composites: RV product precipitation data
- CAP alerts: Official weather warnings
Please refer to the DWD Terms of Use for data usage guidelines.
Acknowledgements
BrightSky API is provided by Jakob de Maeyer. Consider sponsoring his work!
License
MIT License - see LICENSE for details.