openmeteo-rs-ureq

Crates.ioopenmeteo-rs-ureq
lib.rsopenmeteo-rs-ureq
version0.1.1
created_at2025-04-05 14:57:25.480205+00
updated_at2025-04-09 19:09:04.722666+00
descriptionA Rust client for the Open-Meteo API using ureq
homepage
repository
max_upload_size
id1622174
size177,426
Samuel Oldham (SO9010)

documentation

README

Open-Meteo API Rust SDK

Crates.io License: MIT

A Rust SDK for the Open-Meteo Weather API using the ureq HTTP client.

This SDK is based on the official Open-Meteo SDK collection and provides a type-safe way to interact with Open-Meteo's free weather forecast APIs.

Features

  • Type-safe API for Open-Meteo services
  • Built on the lightweight ureq HTTP client
  • Support for weather forecast, historical weather data, and more
  • Ergonomic Rust interface for all API parameters
  • No API key required for most endpoints

Installation

Add the dependency to your Cargo.toml:

[dependencies]
openmeteo-rs-ureq = "0.1.0"  # replace with current version

Usage

Basic Weather Forecast

use openmeteo_rs_ureq::{OpenMeteoClient, WeatherRequest};

fn main() {
    let client = OpenMeteoClient::default();
    let request = WeatherRequest::new(52.52, 13.41)
        .add_hourly("temperature_2m")
        .add_hourly("relative_humidity_2m")
        .add_daily("temperature_2m_max")
        .add_daily("temperature_2m_min")
        .add_current("temperature_2m")
        .temperature_unit("celsius")
        .wind_speed_unit("kmh");

    println!(
        "Got weather forecast for 52.52, 13.41: {:#?}\n",
        client.get_weather(request).unwrap().decode_buffer()
    );
}

Historical Weather Data

use openmeteo_rs_ureq::{HistoricalWeatherRequest, OpenMeteoClient};

fn main() {
    let client = OpenMeteoClient::default();
    let request = HistoricalWeatherRequest::new(52.52, 13.41)
        .add_hourly("temperature_2m")
        .add_daily("temperature_2m_max")
        .start_date("2022-01-01")
        .end_date("2022-01-10")
        .temperature_unit("celsius");

    println!("Got historical weather for 52.52, 13.41: {:#?}\n", client.get_historical_weather(request).unwrap().decode_buffer());
}

Available APIs

  • Weather Forecast API
  • Historical Weather API
  • Marine Forecast API
  • Air Quality API
  • Flood API
  • Climate Change API

Documentation

For detailed API documentation, please visit docs.rs/openmeteo-rs-ureq.

For information about the Open-Meteo API itself, visit open-meteo.com/en/docs.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Commit count: 0

cargo fmt