A collection of utilities to do common things with wreq.
See the crate documentation for more details.
wreq-util offers a set of tower middleware and utilities designed specifically for the wreq HTTP client:
- Emulation various mainstream browsers (Chrome, Firefox, Safari, Opera, OkHttp) and their versions.
- Delay/JitterDelay: Add fixed or jittered delays to HTTP request with customizable strategies and predicates.
Chrome 150 and newer advertise ML-DSA signature algorithms. Chrome 152 and 153
also enable signature algorithm GREASE and send an empty trust_anchors
extension by default. Enable emulation-chromium-pki to send Chromium's Trust
Anchor IDs and enable wreq's matching Chromium root store. A custom certificate
store must trust the requested anchors. The bundled roots do not provide
Chromium's complete certificate verification policy.
The following example uses the Tokio runtime with optional features enabled by adding this to your Cargo.toml:
[dependencies]
tokio = { version = "1", features = ["full"] }
wreq = "0.16"
wreq-util = "0.2"And then the code:
use wreq::Client;
use wreq_util::Emulation;
#[tokio::main]
async fn main() -> wreq::Result<()> {
// Build a client
let client = Client::builder()
.emulation(Emulation::Chrome147)
.build()?;
// Use the API you're already familiar with
let resp = client.get("https://pingly.us.kg/api/all").send().await?;
println!("{}", resp.text().await?);
Ok(())
}Licensed under either of Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0).
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.
For all issues and feedback, please head over to the wreq repository.