#weather #api #api-bindings #forecast #history #future #weer

weer_api

A wrapper library for using Weather API

2 releases

0.1.1 Aug 31, 2022
0.1.0 Aug 31, 2022

#10 in #forecast

Download history 1616/week @ 2024-11-15 1759/week @ 2024-11-22 2029/week @ 2024-11-29 1449/week @ 2024-12-06 1889/week @ 2024-12-13 1985/week @ 2024-12-20 2150/week @ 2024-12-27 1910/week @ 2025-01-03 2823/week @ 2025-01-10 2446/week @ 2025-01-17 2153/week @ 2025-01-24 2310/week @ 2025-01-31 2367/week @ 2025-02-07 2635/week @ 2025-02-14 2250/week @ 2025-02-21 1724/week @ 2025-02-28

9,350 downloads per month

MIT license

37KB
987 lines

Weer api

A wrapper library for using Weather API

This is an unofficial library

Usage

Put this in your Cargo.toml:

[dependencies]
weer_api = "0.1.0"

Examples

Get forecast

use weer_api::{*, chrono::{Utc, TimeZone}};

let client = Client::new("api_key", true);
let result = client.forecast()
    .query(Query::City("London".to_string()))
    .dt(Utc.ymd(2022, 08, 21).and_hms(0, 0, 0))
    .lang(Language::Spanish)
    .call();

assert!(result.is_ok())

Get future

use weer_api::{*, chrono::{Utc, TimeZone}};

let client = Client::new("api_key", true);
let result = client.future()
    .query(Query::Coords(48.8567, 2.3508))
    .dt(Utc.ymd(2022, 09, 21).and_hms(0, 0, 0))
    .lang(Language::Spanish)
    .call();

assert!(result.is_ok())

Get history

use weer_api::{*, chrono::{Utc, TimeZone}};

let client = Client::new("api_key", true);
let result = client.history()
    .query(Query::Ip(None))
    .dt(Utc.ymd(2022, 07, 21).and_hms(0, 0, 0))
    .hour()
    .call();

assert!(result.is_ok())

License

Dependencies

~9MB
~219K SLoC