#http #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

#4 in #requests

Download history 775/week @ 2021-05-27 778/week @ 2021-06-03 770/week @ 2021-06-10 715/week @ 2021-06-17 706/week @ 2021-06-24 708/week @ 2021-07-01 748/week @ 2021-07-08 767/week @ 2021-07-15 755/week @ 2021-07-22 857/week @ 2021-07-29 891/week @ 2021-08-05 710/week @ 2021-08-12 594/week @ 2021-08-19 577/week @ 2021-08-26 561/week @ 2021-09-02 586/week @ 2021-09-09

3,423 downloads per month
Used in 4 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.5MB
~111K SLoC