53 releases

✓ Uses Rust 2018 edition

0.10.1 Jan 9, 2020
0.10.0 Dec 30, 2019
0.10.0-alpha.2 Nov 12, 2019
0.9.24 Dec 11, 2019
0.1.0 Nov 10, 2016

#1 in HTTP client

Download history 62259/week @ 2019-10-04 55676/week @ 2019-10-11 58269/week @ 2019-10-18 55427/week @ 2019-10-25 52982/week @ 2019-11-01 53029/week @ 2019-11-08 53666/week @ 2019-11-15 53338/week @ 2019-11-22 57826/week @ 2019-11-29 66634/week @ 2019-12-06 67163/week @ 2019-12-13 43140/week @ 2019-12-20 40798/week @ 2019-12-27 67623/week @ 2020-01-03 70150/week @ 2020-01-10

238,455 downloads per month
Used in 1,425 crates (1,168 directly)

MIT/Apache

345KB
7K SLoC

reqwest

crates.io Documentation MIT/Apache-2 licensed CI

An ergonomic, batteries-included HTTP Client for Rust.

  • Plain bodies, JSON, urlencoded, multipart
  • Customizable redirect policy
  • HTTP Proxies
  • HTTPS via system-native TLS (or optionally, rustls)
  • Cookie Store
  • Changelog

Example

This asynchronous example uses Tokio and enables some optional features, so your Cargo.toml could look like this:

[dependencies]
reqwest = { version = "0.10", features = ["json"] }
tokio = { version = "0.2", features = ["full"] }

And then the code:

use std::collections::HashMap;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let resp = reqwest::get("https://httpbin.org/ip")
        .await?
        .json::<HashMap<String, String>>()
        .await?;
    println!("{:#?}", resp);
    Ok(())
}

Blocking Client

There is an optional "blocking" client API that can be enabled:

[dependencies]
reqwest = { version = "0.10", features = ["blocking", "json"] }
use std::collections::HashMap;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let resp = reqwest::blocking::get("https://httpbin.org/ip")?
        .json::<HashMap<String, String>>()?;
    println!("{:#?}", resp);
    Ok(())
}

Requirements

On Linux:

On Windows and macOS:

  • Nothing.

Reqwest uses rust-native-tls, which will use the operating system TLS framework if available, meaning Windows and macOS. On Linux, it will use OpenSSL 1.1.

License

Licensed under either of

Contribution

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 dual licensed as above, without any additional terms or conditions.

Dependencies

~2–6.5MB
~162K SLoC