Crates.io | weather-underground |
lib.rs | weather-underground |
version | 0.1.3 |
source | src |
created_at | 2020-10-07 15:07:22.220547 |
updated_at | 2022-06-16 07:44:22.675487 |
description | Weather Underground parser library |
homepage | https://github.com/jdrouet/weather-underground |
repository | https://github.com/jdrouet/weather-underground |
max_upload_size | |
id | 296998 |
size | 138,827 |
A simple library to parse responses from weather underground api.
[dependencies]
weather-underground = "0.1"
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");
}
};