2 releases

0.1.1 Aug 31, 2022
0.1.0 Aug 31, 2022

#8 in #forecast

Download history 732/week @ 2024-01-06 998/week @ 2024-01-13 1052/week @ 2024-01-20 1062/week @ 2024-01-27 1464/week @ 2024-02-03 1101/week @ 2024-02-10 947/week @ 2024-02-17 1487/week @ 2024-02-24 1640/week @ 2024-03-02 1845/week @ 2024-03-09 1686/week @ 2024-03-16 1537/week @ 2024-03-23 1280/week @ 2024-03-30 1344/week @ 2024-04-06 1538/week @ 2024-04-13 1189/week @ 2024-04-20

5,880 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

~8.5MB
~242K SLoC