Crates.io | rparif |
lib.rs | rparif |
version | 0.1.1 |
source | src |
created_at | 2020-05-23 11:36:02.033232 |
updated_at | 2022-06-18 06:31:40.313934 |
description | Library that allow to access AirParif services. |
homepage | https://github.com/Dalvany/r-parif |
repository | https://github.com/Dalvany/r-parif |
max_upload_size | |
id | 244848 |
size | 90,750 |
A Rust library that allows access Airparif indice
pollution API for Ile-de-France (France).
It needs an API key to work.
It allows access to :
Documentation can be found here
With serde feature, data structures implemente Serde's Serialize
and Deserialize
Cargo.toml
[dependencies]
rparif = "0.1"
extern crate rparif;
use rparif::client::RParifClient;
use rparif::error::RParifError;
fn main() -> Result<(), RParifError> {
let client = RParifClient::new("my-api-key");
let indices = client.index()?;
for index in indices.into_iter() {
println!("{}", index);
}
Ok(())
}
With a valid API key :
2020-05-17 (city : None) : ["global"] = 53 (map : Some("https://www.airparif.asso.fr/services/cartes/indice/date/hier"))
2020-05-18 (city : None) : ["global"] = 49 (map : Some("https://www.airparif.asso.fr/services/cartes/indice/date/jour"))
2020-05-19 (city : None) : ["global"] = 49 (map : Some("https://www.airparif.asso.fr/services/cartes/indice/date/demain"))
With an invalid API key :
Error : Some(CallError { url: "https://www.airparif.asso.fr/services/api/1.1/indice?key=wrong-api", body: "{\"erreur\":\"Cl\\u00e9 invalide\"}", status: 403 })
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.