Crate monsoon

Source
Expand description

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.

Modules§

body

Structs§

Monsoon
The main entry point of the library.
Params
The coordinates for which the weather should be looked up.
Response
Response from the API.

Enums§

Error

Type Aliases§

Result