#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

#440 in HTTP client

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 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–12MB
~159K SLoC