#python #http #client #rest #rest-client #python-requests

requests

Rust HTTP客户端API,仿照Python requests的强大功能 - [进行中]

30个版本

使用旧的Rust 2015

0.0.30 2017年4月9日
0.0.27 2017年2月7日
0.0.25 2016年11月12日
0.0.22 2016年7月24日
0.0.4 2016年1月25日

#440HTTP客户端

Download history 23/week @ 2024-03-16 21/week @ 2024-03-23 68/week @ 2024-03-30 15/week @ 2024-04-06 20/week @ 2024-04-13 20/week @ 2024-04-20 25/week @ 2024-04-27 17/week @ 2024-05-04 20/week @ 2024-05-11 16/week @ 2024-05-18 27/week @ 2024-05-25 28/week @ 2024-06-01 21/week @ 2024-06-08 19/week @ 2024-06-15 16/week @ 2024-06-22 3/week @ 2024-06-29

62 每月下载量
3 crates 中使用

MIT 许可证

8KB
181

requests-rs

Rust HTTP客户端库,仿照强大的Python requests

构建状态

分支 状态
master Build Status
develop Build Status

Travis

在OSX 10.11+上构建

export OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include
cargo clean
cargo build

lib.rs:

requests - 简单API的HTTP客户端库。
如果你使用过Python requests模块,你会觉得API很熟悉。

快速入门

extern crate requests;
use requests::ToJson;

fn main() {
    let response = requests::get("http://httpbin.org/get").unwrap();
    assert_eq!(response.url(), "http://httpbin.org/get");
    assert_eq!(response.reason(), "OK");
    assert_eq!(response.status_code(), requests::StatusCode::Ok);

    let data = response.json().unwrap();
    assert_eq!(data["url"], "http://httpbin.org/get");
    assert_eq!(data["headers"]["Host"], "httpbin.org");
    assert_eq!(data["headers"]["User-Agent"],
               concat!("requests-rs/", env!("CARGO_PKG_VERSION")));
}

依赖关系

~4–12MB
~159K SLoC