Skip to main content

httpp

License: MIT CMake 3.21+ C++17 Python 3.8+

A lightweight HTTP client + server library for C++ and Python. pip install httpp and you get: a Python package, a CLI, a compiled C++ library with headers and a CMake config — no system dependencies at all (no apt/choco/brew, nothing outside what pip already gives you).

Why

  • Client and server in one library — most lightweight HTTP libraries only do one side.
  • Zero system dependencies — every third-party piece is vendored and built from source.
  • One pip install, three ways in — Python API, a CLI, and a real C++ library (headers + find_package(httpp)) all come from the same wheel.
  • A migration path for existing libcurl code — httpp/curl_compat.h gives you curl_easy_* so you can often switch with just a header swap.

Install

pip install httpp

Quick start

Python

from httpp import Client, Server, DownloadFile, Request

# client
res = Client.fetch("http://example.com/")
print(res.status, res.body)

# server — like `python -m http.server`, but embeddable in your own app
srv = Server()
srv.serve_directory("/", "./public")
srv.listen("0.0.0.0", 8000)

# download a file, with a tqdm-like progress bar
DownloadFile("http://example.com/big.zip").output("big.zip").run()

# a small curl-flavored request builder
res = Request("http://example.com/api").method("POST").data("a=1").run()

CLI

httpp server .                              # serve the current directory
httpp download http://example.com/          # print body to stdout
httpp download http://example.com/f.zip -o f.zip   # save to a file, with a progress bar
httpp curl -X POST -H "X-Token: abc" -d "a=1" http://example.com/api
httpp install --user                        # put headers/lib/cmake config on your system

C++

#include <httpp.h>

auto res = httpp::client::fetch("http://example.com/");

httpp::server srv;
srv.get("/hello", [](const httpp::request&, httpp::response& res) {
    res.status = 200;
    res.body = "world";
});
srv.listen("0.0.0.0", 8000);

httpp::download_file("http://example.com/f.zip").output("f.zip").run();

auto res2 = httpp::client::request("http://example.com/api")
                .method("POST")
                .header("X-Token", "abc")
                .data("a=1")
                .run();

Migrating from libcurl

#include <httpp/curl_compat.h>   /* was: #include <curl/curl.h> */

CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &out);
CURLcode rc = curl_easy_perform(curl);
curl_easy_cleanup(curl);

Covers the common curl_easy_* subset (URL, method, headers, POST data, write callback, timeout, follow-redirect, response code) — not a full libcurl replacement. See the comment at the top of curl_compat.h for the exact list.

Using it from CMake, from a plain pip install

No system-wide install needed — point CMake at the package Python already installed:

execute_process(
    COMMAND python3 -c "import httpp; print(httpp.get_cmake_dir())"
    OUTPUT_VARIABLE httpp_DIR
    OUTPUT_STRIP_TRAILING_WHITESPACE
)
find_package(httpp CONFIG REQUIRED)
target_link_libraries(app PRIVATE httpp::httpp_core)

Or, after httpp install [--user], plain find_package(httpp) works with no Python involved at all — see tests/cmake/consumer_project for a full working example.

Build from source

git clone --recurse-submodules https://github.com/MohammadRaziei/httpp.git
cd httpp
pip install -r requirements-dev.txt
cmake -B build -DHTTPP_BUILD_TESTS=ON -DHTTPP_BUILD_PYTHON=ON
cmake --build build -j4
ctest --test-dir build --output-on-failure   # C++, Python, and CMake-integration tests

Status

  • httpp::client — GET requests (with optional headers), response headers (res.header("Content-Type")); .fetch(url) parses a full URL in one call. HTTP and HTTPS (mbedtls-backed).
  • httpp::server — route handlers, static directory serving
  • httpp::client::request — a small curl-flavored fluent request builder (method/headers/data/timeout/redirects), also over HTTPS
  • httpp::download_file — fluent download builder with a terminal progress bar (sync .run() and async .run_async())
  • httpp::progress — bar (tqdm-like) and range (trange-like)
  • httpp/curl_compat.h — a curl_easy_* C API subset for migrating existing libcurl code, including response headers (CURLOPT_HEADERFUNCTION) and CURLINFO_CONTENT_TYPE, built directly on httpp::client::request
  • CLI — server, download, curl, install/uninstall, path (httpp --cmake-dir / httpp path --include-dir, etc.)
  • Python bindings for Client, Server, DownloadFile, Request
  • Route handlers from Python (directory serving works today; custom routes are C++-only for now)

License

MIT

Metadata

Release files for httpp 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for httpp 0.5.1
File Size Uploaded Provenance
httpp-0.5.1.tar.gz 241.0 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for httpp 0.5.1
File
httpp-0.5.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
httpp-0.5.1-cp39-abi3-win32.whl CPython 3.9 abi3 Windows x86-32 Details
httpp-0.5.1-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
httpp-0.5.1-cp39-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
httpp-0.5.1-cp39-abi3-macosx_10_13_universal2.whl CPython 3.9 abi3 macOS 10.13+ universal2 (ARM64, x86-64) Details

Total release size: 6.1 MB

Release files / httpp-0.5.1.tar.gz

Download URL httpp-0.5.1.tar.gz
Size 241.0 kB
Tags Source
SHA-256 checksum
How to use checksums
613cab2e9228f322c5e4beac192ae4180563610c6193f2215265526d93d19be9
BLAKE2b-256 checksum
How to use checksums
8c734489f397dac4e92248732851638f361a9ddf6b639ce86c3810334f7b69c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / httpp-0.5.1-cp39-abi3-win_amd64.whl

Download URL httpp-0.5.1-cp39-abi3-win_amd64.whl
Size 725.7 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
7f50f0e30259868f2bb1fa9141cb87e819e3ce1c33ec244c145dd255bf3be1db
BLAKE2b-256 checksum
How to use checksums
456d96443c2edf632984c48de1ac394d628b039f30c1e29eb043079136ab9def
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / httpp-0.5.1-cp39-abi3-win32.whl

Download URL httpp-0.5.1-cp39-abi3-win32.whl
Size 644.3 kB
Tags CPython 3.9 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
d58dfea1355504539575cb09ced6d542a79c8f2bc9a4306bd1d481fcba87348c
BLAKE2b-256 checksum
How to use checksums
20c224a3851379d7ba2b8574de5e0d9f8aff692f5a7be0a3cd82f304450682de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / httpp-0.5.1-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL httpp-0.5.1-cp39-abi3-musllinux_1_2_x86_64.whl
Size 2.0 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
9c523fd8951d38dd77adce56eb569af04b4cf3cff4e0248e26bfe875cfa20d6f
BLAKE2b-256 checksum
How to use checksums
016d2a1be7209731337f152fcd38abcf304b2ca2a6813ff32d6ff9ea5269ca53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / httpp-0.5.1-cp39-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL httpp-0.5.1-cp39-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 928.4 kB
Tags CPython 3.9 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
c1ded42d9a9be2e464041b5884a70bd155eaadf72e61e511d32470fae0203b47
BLAKE2b-256 checksum
How to use checksums
43012a68caa2b7db05aa54bf439bb79e143abbdb80c7c5516485cf46a9b1b47b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / httpp-0.5.1-cp39-abi3-macosx_10_13_universal2.whl

Download URL httpp-0.5.1-cp39-abi3-macosx_10_13_universal2.whl
Size 1.6 MB
Tags CPython 3.9 abi3 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
ecbeb0d61035cab85aab31e5d489686d0bb6fd39f0b548dae818a6ca241175b1
BLAKE2b-256 checksum
How to use checksums
fe818214af66fc81ee7b16a0c2fdbb2a8399e387b97ce0d996586474f0f2f5e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for httpp 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page