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.6.0

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.6.0
File Size Uploaded Provenance
httpp-0.6.0.tar.gz 243.4 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for httpp 0.6.0
File
httpp-0.6.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
httpp-0.6.0-cp39-abi3-win32.whl CPython 3.9 abi3 Windows x86-32 Details
httpp-0.6.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
httpp-0.6.0-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.6.0-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.6.0.tar.gz

Download URL httpp-0.6.0.tar.gz
Size 243.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f4fab9e6c7fd000dd140f572f64ff797481004ec0be834e5de1d5fea0b1e4c37
BLAKE2b-256 checksum
How to use checksums
d8f55545f0c51a78c9d818a2bbac67cfa653dbb9ede710db80cf575d6f040259
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.6.0-cp39-abi3-win_amd64.whl

Download URL httpp-0.6.0-cp39-abi3-win_amd64.whl
Size 731.3 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
7d4d985db9ab0986ae20a9fb36ab3a55f0cf76b90536186c384c595ec494e536
BLAKE2b-256 checksum
How to use checksums
b6a339df9f56f1eae53cb23ef019004b71292a5f4e9e93f199bc14f1e07e5d5c
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.6.0-cp39-abi3-win32.whl

Download URL httpp-0.6.0-cp39-abi3-win32.whl
Size 650.1 kB
Tags CPython 3.9 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
7c68220f55b05cb3ff2ab1788ac8cb14082158b408bf36743732657d0ada10ef
BLAKE2b-256 checksum
How to use checksums
12e12f8b3c45f04aa42b503912b27fdbf242b40f42000e52b3492b33f617d074
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.6.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL httpp-0.6.0-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
54fd6b90403225a046c7e0f15a9acf85ec13f33cddeeef18e6cb57b1a968402d
BLAKE2b-256 checksum
How to use checksums
7fb28cc7bac7d646414f1896f68aaa155bb54e59f29962641e13fdd7543e892f
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.6.0-cp39-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL httpp-0.6.0-cp39-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 934.3 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
6de1b33e9ea3ab4e3d3821384dad4b20c502de5db7a64e498bbeb7d6a537005c
BLAKE2b-256 checksum
How to use checksums
f5e975703767e34bb90921a279523405b8a5c2b0b3b4e32156400c3e768083a2
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.6.0-cp39-abi3-macosx_10_13_universal2.whl

Download URL httpp-0.6.0-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
b8003c5b4e04f93e584f288f65de512be1454d6172990dc8371d20f704537f41
BLAKE2b-256 checksum
How to use checksums
90ce77613391d8dead4caf77ec4c6c213e79e0083b89665254226c2659f24241
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.6.0

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