#weather #parser #parse

weather-underground

Weather Underground parser library

4 releases

0.1.3 Jun 16, 2022
0.1.2 Feb 27, 2022
0.1.1 Oct 8, 2020
0.1.0 Oct 7, 2020

#69 in #weather

Download history 1/week @ 2024-07-18 53/week @ 2024-07-25 8/week @ 2024-08-01 3/week @ 2024-09-19 5/week @ 2024-09-26 2/week @ 2024-10-03

61 downloads per month
Used in 3 crates (2 directly)

MIT license

31KB
197 lines

Weather underground library

A simple library to parse responses from weather underground api.

Installation

[dependencies]
weather-underground = "0.1"

Usage

use std::convert::TryFrom;
use std::time::Duration;
use weather_underground as wu;

async {
    let client = wu::create_client(Duration::from_secs(2)).unwrap();
    let api_key = wu::fetch_api_key(&client).await.unwrap();
    let unit = wu::Unit::Metric;
    let result = wu::fetch_observation(&client, api_key.as_str(), "IPARIS18204", &unit).await.unwrap();
    if let Some(response) = result {
        let response = wu::ObservationResponse::try_from(response).unwrap();
        println!("response: {:?}", response);
    } else {
        println!("no data from server");
    }
};

Dependencies

~12–26MB
~481K SLoC