#weather #forecast #met #api #yr

monsoon

Monsoon is a library for accessing weather data produced by The Norwegian Meteorological Institute. Most notably, this data is used on Yr.no.

2 releases

0.1.1 Mar 19, 2023
0.1.0 Mar 19, 2023

#15 in #forecast

Download history 4/week @ 2024-09-19 1/week @ 2024-09-26 31/week @ 2024-10-10 59/week @ 2024-10-17 83/week @ 2024-10-24 11/week @ 2024-10-31

184 downloads per month

MIT license

21KB
398 lines

Monsoon

Monsoon is a library for accessing weather data produced by The Norwegian Meteorological Institute. Most notably, this data is used on Yr.no.

Example

let monsoon = Monsoon::new("test.com support@test.com")?;

// Prague
let response = monsoon.get(50.0880, 14.4207).await?;
let body = response.body()?;

License

  • MIT license

lib.rs:

Monsoon is a library for accessing weather data produced by The Norwegian Meteorological Institute. Most notably, this data is used on Yr.no.

Example:

use std::error::Error;
use monsoon::Monsoon;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
  let monsoon = Monsoon::new("test.com support@test.com")?;
  let response = monsoon.get(50.0880, 14.4207).await?;
  let body = response.body()?;
  dbg!(body);

  Ok(())
}

You're required to properly identify yourself. In this case, the string "test.com support@test.com" will be sent in the User-Agent of every request.

You're further required to a rate limit of 20 requests per second and to respect the "Expires" header of each response. Monsoon doesn't implement these rules on its own but it does implement the Service trait of Tower and as such you can use middleware in the Tower ecosystem to implement them. See Examples. Finally, see the Terms of Service for more information.

Dependencies

~5–20MB
~290K SLoC