Skip to content

06chaynes/surf-governor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

surf-governor

A rate-limiting middleware for surf

Install

With cargo add installed :

cargo add surf-governor

Documentation

Example

use surf_governor::GovernorMiddleware;
use surf::{Client, Request, http::Method};
use url::Url;

#[async_std::main]
async fn main() -> surf::Result<()> {
    let req = Request::new(Method::Get, Url::parse("https://example.api")?);
    let client = Client::new().with(GovernorMiddleware::per_second(1)?);
    let res = client.send(req).await?;
    Ok(())
}

About

A rate-limiting middleware for surf

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages