Crates.io | reqwest-ratelimit |
lib.rs | reqwest-ratelimit |
version | 0.2.0 |
source | src |
created_at | 2023-09-28 18:58:14.040272 |
updated_at | 2024-05-04 22:29:43.504107 |
description | Rate-limit middleware for reqwest. |
homepage | |
repository | https://github.com/xDarksome/reqwest-ratelimit |
max_upload_size | |
id | 986495 |
size | 5,151 |
Rate-limit middleware implementation for
reqwest-middleware
.
use async_trait::async_trait;
use reqwest_middleware::{ClientBuilder, ClientWithMiddleware};
struct RateLimiter;
#[async_trait]
impl reqwest_ratelimit::RateLimiter for RateLimiter {
async fn acquire_permit(&self) {
// noop
}
}
async fn run() {
let client = ClientBuilder::new(reqwest::Client::new())
.with(reqwest_ratelimit::all(RateLimiter))
.build();
client.get("https://crates.io").send().await.unwrap();
}