#weather #forecast #api #met #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

#14 in #forecast

24 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

~4–19MB
~311K SLoC