在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:seanmonstar/reqwest开源软件地址:https://github.com/seanmonstar/reqwest开源编程语言:Rust 100.0%开源软件介绍:reqwestAn ergonomic, batteries-included HTTP Client for Rust.
ExampleThis asynchronous example uses Tokio and enables some
optional features, so your [dependencies]
reqwest = { version = "0.11", features = ["json"] }
tokio = { version = "1", 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 ClientThere is an optional "blocking" client API that can be enabled: [dependencies]
reqwest = { version = "0.11", 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(())
} RequirementsOn Linux:
On Windows and macOS:
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. LicenseLicensed under either of
ContributionUnless 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. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论