Advanced HTTP client with low-level TLS and browser fingerprint spoofing based on Go tls-client FFI
Project description
🌌 Horaa TLS
State-of-the-art in-process browser fingerprint emulation and HTTP client for Python.
horaa-tls is a high-performance HTTP client designed to evade anti-bot security layers (such as Cloudflare Turnstile, Akamai, Imperva, and DataDome). By interfacing directly with a precompiled Go-based BoringSSL networking backend via a ctypes FFI wrapper, it maintains a footprint indistinguishable from a real web browser at both the TLS socket and HTTP/2 layer.
⚙️ Installation
Install horaa-tls directly from PyPI:
pip install horaa-tls
💡 Why Horaa TLS?
- Zero External Dependencies: Automatically detects your OS and architecture, downloads the matching precompiled Go libraries, and initializes everything dynamically without requiring third-party pip dependencies.
- Cryptographic Emulation: Leverages preset browser profiles (Chrome 133, Firefox 133, etc.) to negotiate matching TLS extensions, cipher suites, key share curves, and HTTP/2 settings.
- Aligned User-Agents & Client Hints: Keeps HTTP/2 Client Hints (
Sec-Ch-Ua,Sec-Ch-Ua-Mobile,Sec-Ch-Ua-Platform) perfectly aligned with the selected browser TLS version to prevent anti-bot detection signals. - Decoupled Middleware Hooks: Register asynchronous or synchronous middleware layers (such as rotators and retries) directly in the request-response cycle.
🚀 Quick Start (The One-Minute Tour)
Initialize a session mimicking a Chrome 133 browser:
from horaa_tls import Session, ClientProfile
# Create a stateful, browser-emulating session
session = Session(profile=ClientProfile.CHROME_133)
try:
# Perform a request (headers, JA3/JA4, and Client Hints are automatically injected)
response = session.get("https://httpbingo.org/get")
print(f"Status Code: {response.status_code}")
print(response.json())
finally:
# Always close the session to release low-level FFI memory allocations
session.close()
🛠️ Core Concepts & Advanced Guide
🧬 Aligned Browser Profiles
horaa-tls currently offers pre-configured emulation profiles:
- Chrome Series:
chrome_103,chrome_110,chrome_120,chrome_133 - Firefox Series:
firefox_117,firefox_123,firefox_133 - Safari Series:
safari_16_0,safari_ios_17_0 - Opera Series:
opera_90
🏗️ Stateful Middleware Pipeline
You can easily intercept, modify, or retry requests using the built-in middleware engine. Registering rotators or exponential backoffs is straightforward:
from horaa_tls import Session, ClientProfile
from horaa_tls.middleware.proxy import ProxyRotatorMiddleware
from horaa_tls.middleware.retry import RetryMiddleware
session = Session(profile=ClientProfile.CHROME_133)
# 1. State-aware proxy rotator with failover recovery
proxies = ["http://proxy1.example.com:8080", "http://proxy2.example.com:8080"]
session.middleware_pipeline.register(
ProxyRotatorMiddleware(proxies=proxies, mode="failover", max_failovers=3)
)
# 2. Exponential backoff retry handler for transport/network drops
session.middleware_pipeline.register(
RetryMiddleware(max_retries=3, backoff_factor=2.0, status_forcelist=[500, 502, 503, 504])
)
# Request executes automatically through the middleware pipeline
res = session.get("https://httpbingo.org/get")
session.close()
📦 Session Snapshots (Persistence)
Export and restore session states (cookies, custom headers, active proxies, and middleware indicators) to distribute scraper instances across servers or queues:
# Save current state
session_state_json = session.to_json()
# Recreate an identical session in a different worker/process
restored_session = Session.from_json(session_state_json)
🍪 Direct FFI Cookie Management
Interact directly with the Go-layer cookie jar for fine-grained token/session management:
# Read active cookies stored in the Go memory layer
cookies = session.get_cookies_from_backend("https://example.com")
# Inject cookies directly into the Go-layer FFI engine
session.add_cookies_to_backend("https://example.com", [
{"name": "session_token", "value": "token_value", "domain": ".example.com", "path": "/"}
])
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file horaa_tls-0.1.1.tar.gz.
File metadata
- Download URL: horaa_tls-0.1.1.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abc7d8a5b4bcb3947a1fd7ea7949f5f2665a009bbb32af902502164992563a60
|
|
| MD5 |
f72840f1991e47daffe98d39a405c621
|
|
| BLAKE2b-256 |
585d97df305140401f8e11172dd24b53de69b042a3848cc6739cc58456681fdc
|
File details
Details for the file horaa_tls-0.1.1-py3-none-any.whl.
File metadata
- Download URL: horaa_tls-0.1.1-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca354a8b82ef8857154e069b63da1792081bd7edb81d7bfee0c79ec4fab92cef
|
|
| MD5 |
062c2ecbb6435720be43b3220a11a7df
|
|
| BLAKE2b-256 |
c67e034287ed49d1a99bac8f2514b3780e4cf1e5803479b2c0c8a67e3c178128
|