2 releases

0.1.1 Aug 31, 2022
0.1.0 Aug 31, 2022

#11 in #forecast

Download history 2683/week @ 2024-07-20 1924/week @ 2024-07-27 2462/week @ 2024-08-03 1923/week @ 2024-08-10 1967/week @ 2024-08-17 2232/week @ 2024-08-24 3144/week @ 2024-08-31 1209/week @ 2024-09-07 1234/week @ 2024-09-14 1657/week @ 2024-09-21 1523/week @ 2024-09-28 1846/week @ 2024-10-05 2061/week @ 2024-10-12 1699/week @ 2024-10-19 1732/week @ 2024-10-26 1551/week @ 2024-11-02

7,269 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