Skip to main content

⚡ http_tls

High-performance Rust-powered HTTP client with byte-exact TLS (JA3/JA4) & HTTP/2 fingerprint impersonation.
100% Drop-in replacement for both requests and curl_cffi.

CI & Release Wheels License: MIT Python Rust Fingerprint

English • Tiếng Việt


🌟 Why http_tls?

Traditional HTTP libraries (requests, urllib3, aiohttp, httpx) are blocked instantly by modern anti-bot systems (Cloudflare Bot Management, Akamai, DataDome, CloudFront) because their TLS ClientHello (JA3/JA4) and HTTP/2 settings frames leak signatures.

curl_cffi solved this by wrapping C-based curl-impersonate, but suffers from complex C runtime dependencies, memory leak risks in long-running async loops, and difficult cross-compilation.

http_tls is engineered in Rust to give you the best of both worlds:

  1. Byte-Exact TLS & HTTP/2 Fingerprint: Generates identical JA4 hashes (t13d1517h2_...) and Chrome HTTP/2 pseudo-header ordering (:method, :authority, :scheme, :path -> m,a,s,p).
  2. 100% Drop-in for requests: Replace import requests with import http_tls as requests — zero code changes required.
  3. 100% Drop-in for curl_cffi: Fully compatible with from http_tls import requests, BrowserType.
  4. Blazing Fast (+32% Throughput): Multi-threaded Rust core with complete Python GIL release (py.allow_threads).
  5. Modern 2026 Presets: Ships with presets up to Chrome 152, Safari 27, Firefox 155, and Edge 152, plus dynamic version generation.
  6. Self-Contained & Stable ABI3: Single wheel distribution for all Python versions (3.8 - 3.14+).

📊 Benchmarks & Fingerprint Parity

Tested against https://tls.peet.ws/api/all (the canonical TLS fingerprint diagnostic tool):

Metric requests / httpx curl_cffi (pip) http_tls (Rust) Cloudflare Status
JA4 TLS Hash t13d1011h2 (Bot) t13d1517h2 (Chrome) t13d1517h2 (Chrome) ✅ PASSED
H2 Pseudo-Headers m,s,a,p (Bot) m,a,s,p (Chrome) m,a,s,p (Chrome) ✅ PASSED
H2 Akamai Settings Mismatched Browser-exact Browser-exact ✅ PASSED
Throughput (10 reqs) ~520 ms/req ~437 ms/req ~296 ms/req (32% faster) ⚡ FASTEST
Memory Safety Python Managed C Pointers (Manual) Rust RAII (Safe) 🛡️ SAFE

🚀 Quick Start

Installation

pip install http-tls

Or build from source via Maturin:

git clone https://github.com/real-coder-xD/http_tls.git
cd http_tls
pip install maturin
maturin build --release
pip install ./target/wheels/*.whl

Mode 1: 100% Drop-in for requests

Simply swap your import. All existing code, sessions, headers, and exception handling work seamlessly:

import http_tls as requests

# GET request with automatic Chrome 152 impersonation
resp = requests.get("https://httpbin.org/get", timeout=10)
resp.raise_for_status()

# Standard requests properties
print(resp.status_code == requests.codes.ok) # True
print(resp.ok)                                # True
print(resp.headers["content-type"])          # Case-insensitive headers!

# Session with cookie persistence and custom headers
with requests.Session() as s:
    s.headers.update({"Authorization": "Bearer secret_token"})
    s.get("https://httpbin.org/cookies/set?user=dev")
    
    r = s.get("https://httpbin.org/cookies")
    print(r.json()["cookies"])  # {'user': 'dev'}

Mode 2: 100% Drop-in for curl_cffi

If your project currently imports curl_cffi:

from http_tls import requests
from http_tls import BrowserType

# Use BrowserType enum or string presets
resp = requests.get(
    "https://www.upwork.com",
    impersonate=BrowserType.chrome152,
    proxies={"all": "http://user:pass@proxy.example.com:8080"}
)
print("Status:", resp.status_code)
print("CF-Ray:", resp.headers.get("cf-ray"))

Mode 3: Native High-Performance Async (asyncio)

Crawl hundreds of protected endpoints concurrently:

import asyncio
import http_tls

async def worker(session, index):
    url = f"https://httpbin.org/anything?idx={index}"
    resp = await session.get(url)
    return resp.json()["args"]

async def main():
    async with http_tls.AsyncSession(impersonate="chrome_152") as session:
        tasks = [worker(session, i) for i in range(20)]
        results = await asyncio.gather(*tasks)
        print(f"Fetched {len(results)} items successfully!")

asyncio.run(main())

🎛️ Dual-Engine Architecture

http_tls gives you explicit control over the network engine:

import http_tls

# Engine 1: 'impersonate' (Default / Auto)
# 100% byte-exact TLS & H2 frames to bypass Cloudflare Bot Management & Akamai.
with http_tls.Session(impersonate="chrome_152", engine="impersonate") as s:
    resp = s.get("https://www.upwork.com")

# Engine 2: 'rust'
# Pure Rust Tokio + Rustls runtime. Maximum memory safety and zero external C dependencies.
with http_tls.Session(impersonate="chrome_152", engine="rust") as s:
    resp = s.get("https://httpbin.org/get")

🎯 Supported Browser Presets (Updated to Nov 2026)

  • Chrome (Default chrome_152): chrome_152, chrome_152_macos, chrome_151, chrome_150, chrome_146, chrome_145, chrome_142, chrome_136, chrome_133, chrome_131, chrome_130, chrome_128, chrome_124
  • Dynamic Generator: You can pass any chrome_{N} version (e.g. chrome_135), and http_tls will automatically calculate GREASE ciphers, Client Hints, and Sec-CH-UA.
  • Edge: edge_152, edge_142, edge_131, edge_128, edge_124
  • Safari: safari_27, safari_26, safari_18_4, safari_18, safari_17
  • Firefox: firefox_155, firefox_154, firefox_153, firefox_147, firefox_144, firefox_135, firefox_133, firefox_130
  • Tor: tor_14_5

🛡️ Cloudflare & WAF Bypass Cheat Sheet

  1. Cloudflare CDN / Basic WAF: Passes automatically with 200 OK.
  2. Cloudflare Bot Management (Super Bot Fight Mode): http_tls matches Chrome's JA4 and HTTP/2 settings, preventing 403 blocks.
  3. Turnstile / Managed Challenge ("Just a moment..."):
    • Recommended: Pair http_tls with clean Residential Proxies so Cloudflare skips the challenge.
    • Alternative: Solve Turnstile once via headless browser (playwright/nodriver) and pass the cf_clearance cookie into http_tls.Session(cookies={"cf_clearance": "..."}).

🇻🇳 Xem hướng dẫn chi tiết bằng Tiếng Việt (Click để mở)

Hướng dẫn Tiếng Việt

http_tls là thư viện HTTP Client viết bằng Rust cho Python, thiết kế để thay thế hoàn hảo cho cả requests và curl_cffi:

  1. Thay thế requests:
    import http_tls as requests
    resp = requests.get("https://httpbin.org/get")
    print(resp.json())
    
  2. Thay thế curl_cffi:
    from http_tls import requests, BrowserType
    resp = requests.get("https://target.com", impersonate=BrowserType.chrome152)
    
  3. Cào dữ liệu Async đa luồng:
    import asyncio, http_tls
    async def main():
        async with http_tls.AsyncSession(impersonate="chrome_152") as s:
            r = await s.get("https://httpbin.org/get")
            print(r.status_code)
    asyncio.run(main())
    

📄 License

Released under the MIT License.

Metadata

Release files for http-tls 0.2.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 http-tls 0.2.1
File Size Uploaded Provenance Actions
http_tls-0.2.1.tar.gz 33.7 kB With provenance Details for http_tls-0.2.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for http-tls 0.2.1
File Actions
http_tls-0.2.1-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for http_tls-0.2.1-cp38-abi3-win_amd64.whl
http_tls-0.2.1-cp38-abi3-manylinux_2_38_x86_64.whl CPython 3.8 abi3 Linux glibc 2.38+ x86-64 Details for http_tls-0.2.1-cp38-abi3-manylinux_2_38_x86_64.whl
http_tls-0.2.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for http_tls-0.2.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
http_tls-0.2.1-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for http_tls-0.2.1-cp38-abi3-macosx_11_0_arm64.whl
http_tls-0.2.1-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details for http_tls-0.2.1-cp38-abi3-macosx_10_12_x86_64.whl

Total release size: 12.0 MB

Release files / http_tls-0.2.1.tar.gz

Download URL http_tls-0.2.1.tar.gz
Size 33.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b4408984045e00595347f608e3f24a2a7f8cfbddd03043ce901f8f259071787e
BLAKE2b-256 checksum
How to use checksums
aa8c2ba4c0c9d05860238a06bfceb56cc8e4214e38f115d04ca46615bb199a8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / http_tls-0.2.1-cp38-abi3-win_amd64.whl

Download URL http_tls-0.2.1-cp38-abi3-win_amd64.whl
Size 2.1 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
cd5dd69b029ca7ea66e7ae296f90d1fcaadbf1b1ee3538125ff9fd274afaddb8
BLAKE2b-256 checksum
How to use checksums
69233443611ca9d3a28c5a2460e473363899099d25cebe2d8b096e4fc7a18a26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / http_tls-0.2.1-cp38-abi3-manylinux_2_38_x86_64.whl

Download URL http_tls-0.2.1-cp38-abi3-manylinux_2_38_x86_64.whl
Size 2.6 MB
Tags CPython 3.8 Linux glibc 2.38+ x86-64 abi3
SHA-256 checksum
How to use checksums
d66f994103b7e4ef5f7ab07228d370e5a25cb790fad4b5d8fb1386716c27a4f4
BLAKE2b-256 checksum
How to use checksums
a2ced5c65eb06a7cb3e36d51562145b3c94d381c42bfbe6ea8e5ab09b94f3d77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / http_tls-0.2.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL http_tls-0.2.1-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 2.4 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
d2db7842abe84f11239d80647912daedc779572c51b11d19ef7d3e0eb8f34e12
BLAKE2b-256 checksum
How to use checksums
9ba28777e39c0d1c60bf384ab035ea81188183e8a143a88b326023dfde666aa9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / http_tls-0.2.1-cp38-abi3-macosx_11_0_arm64.whl

Download URL http_tls-0.2.1-cp38-abi3-macosx_11_0_arm64.whl
Size 2.3 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c5936bd4deb6db48fc01de63d2ff32376857f3fb5dcd778e434ae619c6cee438
BLAKE2b-256 checksum
How to use checksums
73707b7f8de505a35d314f229f935da9df1ffc8e950e9b86112572055cbb70a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / http_tls-0.2.1-cp38-abi3-macosx_10_12_x86_64.whl

Download URL http_tls-0.2.1-cp38-abi3-macosx_10_12_x86_64.whl
Size 2.5 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
527b7f6ab9e7230f965f6375f913b212f4bcb0fb7835d74dc5ea8a551ab7bd76
BLAKE2b-256 checksum
How to use checksums
fc279703982e38d02053665b12575d55999e33ac73bb2b1b795567216ab48731
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for http-tls 0.2.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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for http_tls-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

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