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

requests

Rust HTTP client API styled after awesome Python requests - [WORK IN PROGRESS]

30 releases

Uses old Rust 2015

0.0.30 Apr 9, 2017
0.0.27 Feb 7, 2017
0.0.25 Nov 12, 2016
0.0.22 Jul 24, 2016
0.0.4 Jan 25, 2016

#411 in HTTP client

Download history 3/week @ 2023-12-13 4/week @ 2023-12-20 2/week @ 2024-01-03 6/week @ 2024-01-10 5/week @ 2024-01-17 2/week @ 2024-01-24 4/week @ 2024-02-07 12/week @ 2024-02-14 54/week @ 2024-02-21 51/week @ 2024-02-28 25/week @ 2024-03-06 24/week @ 2024-03-13 27/week @ 2024-03-20 17/week @ 2024-03-27

95 downloads per month
Used in 3 crates

MIT license

8KB
181 lines

requests-rs

Rust HTTP client library styled after awesome Python requests

Build status

branch status
master Build Status
develop Build Status

Travis

Building on OSX 10.11+

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

lib.rs:

requests - HTTP client library with simple API.
If you have used Python requests module you will find the API familiar.

Quick Start

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")));
}

Dependencies

~4–13MB
~173K SLoC