Skip to main content

Native Python request client with browser-shaped TLS and HTTP/2 transport profiles

Project description

re-quest

Native Python HTTP client with browser-shaped TLS and HTTP/2 transport profiles

Python License Transport Status

re-quest gives Python a request-style API with direct control over TLS and HTTP/2 transport behavior.


Overview

re-quest is a native Python HTTP client designed for transport-aware applications.

Unlike typical Python HTTP clients, re-quest does not rely on the standard ssl request path for its native transport. It constructs ClientHello messages, negotiates TLS, and emits HTTP/2 frames through its own transport implementation.

It keeps the high-level API familiar while exposing browser-shaped transport profiles for TLS, ALPN, HTTP/2 settings, ordered headers, and coherent request metadata.


Highlights

  • Request-style synchronous API
  • Session support
  • Cookies and redirects
  • Ordered browser-style headers
  • Native TLS 1.3 path
  • Native TLS 1.2 fallback path
  • Native HTTP/2 request framing
  • HTTP/1.1 fallback
  • Browser profile registry
  • Fingerprint observation helpers

Installation

python3 -m pip install .

Runtime dependencies:

cryptography>=42
hpack>=4
Brotli>=1
zstandard>=0.23

Quick Start

from re_quest import Session

with Session(profile="chrome") as session:
    response = session.get("https://example.com/")
    print(response.status_code)
    print(response.text[:200])

Session Usage

from re_quest import Session

with Session(profile="android148", timeout=20) as session:
    r1 = session.get("https://example.com/")
    r2 = session.get("https://example.com/next")

    print(r1.status_code)
    print(r2.status_code)

Custom Headers

from re_quest import Session

with Session(profile="chrome") as session:
    response = session.get(
        "https://example.com/",
        headers={
            "X-Demo": "1",
        },
    )

    print(response.status_code)

JSON and Form Requests

from re_quest import Session

with Session(profile="chrome") as session:
    json_response = session.post(
        "https://example.com/api",
        json={"hello": "world"},
    )

    form_response = session.post(
        "https://example.com/form",
        data={"username": "alice"},
    )

Fingerprint Probe

from re_quest import Session

with Session(profile="android148") as session:
    response = session.get("https://tls.peet.ws/api/all")
    data = response.json()

    print(data.get("http_version"))
    print(data.get("tls", {}).get("ja3"))
    print(data.get("http2", {}).get("akamai_fingerprint"))

CLI

List available profiles:

re-quest profiles

Send a request:

re-quest request https://example.com/ --profile chrome

Collect a fingerprint observation:

re-quest fingerprint --profile android148 --out artifacts/fingerprints

Summarize observations:

re-quest report artifacts/fingerprints/*.json

Built-in Profiles

from re_quest import list_profiles

print(list_profiles())

Common aliases:

Alias Description
chrome Default Chromium desktop profile
chrome_windows Chromium desktop profile
android148 Android Chrome 148-style profile
firefox Firefox-style header profile
safari Safari-style header profile
ios iOS Safari-style header profile
edge Edge-style header profile

Some profiles include native Chromium-shaped transport settings. Other profiles currently provide coherent headers while sharing the default native transport shape.


Limitations

  • HTTP/3/QUIC is not implemented.
  • JavaScript and browser runtime APIs are out of scope.
  • Browser profiles require ongoing validation as real browsers change.
  • Some non-Chromium profiles are currently header-level profiles.

Development

Install development dependencies:

python3 -m pip install '.[dev]'

Run tests:

python3 -m pytest

Lightweight syntax/import check:

python3 -m compileall -q re_quest tests examples

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

re_quest-0.4.1.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

re_quest-0.4.1-py3-none-any.whl (44.5 kB view details)

Uploaded Python 3

File details

Details for the file re_quest-0.4.1.tar.gz.

File metadata

  • Download URL: re_quest-0.4.1.tar.gz
  • Upload date:
  • Size: 36.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for re_quest-0.4.1.tar.gz
Algorithm Hash digest
SHA256 0f2614262b2ca8936f6e2f89dc60fac38a0fd9c369a6caa17c6f60f6913547cb
MD5 845d5c6106ca8799b62b26ebef09076e
BLAKE2b-256 104c7872ee707ce713e54ce6bc915395de613d3e70e9269a778f0d83bf2ef8c3

See more details on using hashes here.

File details

Details for the file re_quest-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: re_quest-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 44.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for re_quest-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 28714a9d75800a3dcce2ab29a7ff20f47a6a32a731918bd0becadb8c7a0bda0c
MD5 fe6b0c85a6bdae3d0903f4b347e046e4
BLAKE2b-256 f8fce68982f3fcd76bdaf9a11d304cc4f9cab1d4a22fbdff80a88eb5f9f66f00

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page