Requests

C++ Requests library using Boost

Documentation

This project is maintained by Y77CHâ„¢

cq == C++ Requests is a Python Requests like library for sending HTTP requests. The library is inspired a lot by the Cpr project, yet uses Boost instead of cURL. We aim for most simple workflow with both HTTP and HTTPS protocols.

Sending a GET request is nothing more than:

#include <cq/requests.hpp>

int main()
{
  Requests::Response r = Requests::get("https://api.github.com/user", Requests::Auth{"user", "pass"});

  r.status_code;             // 200
  r.headers["content-type"]; // "application/json; charset=utf8"
  r.text;                    // "{\"type\":\"User\"..."

  return 0;
}

Features

C++ Requests currently supports:

Planned

The following features will be added in next releases:

And more!

Dependencies

Requests deliberately uses most modern C++20 features, hence it requires lastest versions of compilers.

It also requires:

Install

  1. Install dependencies
    sudo apt-get install libboost-dev openssl
    
  2. Download sources
    git clone https://github.com/Y77CH/cq
    
  3. Build project
    mkdir build
    cd build
    cmake ..
    cmake --build .
    
  4. Install
    cmake --install .
    

Contributing

Please fork this repository and contribute back using pull requests. Features can be requested using issues. All code, comments, and critiques are greatly appreciated.