Browser fingerprint emulation HTTP client with HTTP/1.1, HTTP/2, and HTTP/3 support
Project description
HTTPCloak Python
Browser fingerprint emulation HTTP client with HTTP/1.1, HTTP/2, and HTTP/3 support.
Installation
pip install httpcloak
Quick Start
Synchronous Usage
from httpcloak import Session
# Create a session with Chrome fingerprint
session = Session(preset="chrome-143")
# Make requests
response = session.get("https://www.cloudflare.com/cdn-cgi/trace")
print(response.status_code)
print(response.text)
# POST request
response = session.post("https://api.example.com/data", body={"key": "value"})
# Custom headers
response = session.get("https://example.com", headers={"X-Custom": "value"})
# With proxy
session = Session(preset="chrome-143", proxy="http://user:pass@host:port")
Asynchronous Usage
import asyncio
from httpcloak import Session
async def main():
session = Session(preset="chrome-143")
# Async GET
response = await session.get_async("https://example.com")
print(response.text)
# Async POST
response = await session.post_async("https://api.example.com/data", body={"key": "value"})
# Multiple concurrent requests
responses = await asyncio.gather(
session.get_async("https://example.com/1"),
session.get_async("https://example.com/2"),
session.get_async("https://example.com/3"),
)
asyncio.run(main())
Cookie Management
from httpcloak import Session
session = Session()
# Get all cookies
cookies = session.get_cookies()
print(cookies)
# Set a cookie
session.set_cookie("session_id", "abc123")
# Access cookies as property
print(session.cookies)
Available Presets
from httpcloak import available_presets
print(available_presets())
# ['chrome-143', 'chrome-143-windows', 'chrome-143-linux', 'chrome-143-macos',
# 'chrome-131', 'firefox-133', 'safari-18', ...]
Response Object
response = session.get("https://example.com")
response.status_code # int: HTTP status code
response.headers # dict: Response headers
response.body # bytes: Raw response body
response.text # str: Response body as text
response.final_url # str: Final URL after redirects
response.protocol # str: Protocol used (http/1.1, h2, h3)
Error Handling
from httpcloak import Session, HTTPCloakError
try:
session = Session()
response = session.get("https://example.com")
except HTTPCloakError as e:
print(f"Request failed: {e}")
Context Manager
from httpcloak import Session
with Session(preset="chrome-143") as session:
response = session.get("https://example.com")
print(response.text)
# Session automatically closed
Platform Support
- Linux (x64, arm64)
- macOS (x64, arm64)
- Windows (x64, arm64)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
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 httpcloak-1.0.3-py3-none-win_amd64.whl.
File metadata
- Download URL: httpcloak-1.0.3-py3-none-win_amd64.whl
- Upload date:
- Size: 3.8 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5240e8eaccd63299148de33aa2092ceccfc0d234065862b00a42e8f61490ac8f
|
|
| MD5 |
df7f843aca5167fcccdf3325b2718c57
|
|
| BLAKE2b-256 |
146575401d31e257a17295a63a0d75c95fa492b8d246ddc433785e98d60fcf88
|
File details
Details for the file httpcloak-1.0.3-py3-none-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: httpcloak-1.0.3-py3-none-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 3.9 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd1446fb6b993b46b1141e38d274f119be4e28652d26990a0329045e651e3aee
|
|
| MD5 |
dd3fd2e7bb84b4b152ee3b9b0090700d
|
|
| BLAKE2b-256 |
dce47dc17a2e6551b3f12c545d80ecf70ef90bac89c2657c46504d78bfdc8fee
|
File details
Details for the file httpcloak-1.0.3-py3-none-manylinux_2_17_aarch64.whl.
File metadata
- Download URL: httpcloak-1.0.3-py3-none-manylinux_2_17_aarch64.whl
- Upload date:
- Size: 3.6 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
761ba3397788e9109ccc3188e308fc1e75a6761c105094052522055ffe0b40e0
|
|
| MD5 |
6ee21d04c27dd7b1a76532d05f8911a4
|
|
| BLAKE2b-256 |
64ff1537b944f437f3aa2784f179d87f4d1ad87c40efa1dbf1d984afe9a13960
|
File details
Details for the file httpcloak-1.0.3-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: httpcloak-1.0.3-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.5 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd0092f0a5535d5f9e3adadd1392898d3f8dbbe8e776ccd0ffe8e02c36e2e039
|
|
| MD5 |
e2fe4d38a7ae6404a5aee41369f36a33
|
|
| BLAKE2b-256 |
1e0727e4e8f31966a3c1c6f3890a5e8883908f78a63abaefa873e6b42897a37d
|
File details
Details for the file httpcloak-1.0.3-py3-none-macosx_10_9_x86_64.whl.
File metadata
- Download URL: httpcloak-1.0.3-py3-none-macosx_10_9_x86_64.whl
- Upload date:
- Size: 3.7 MB
- Tags: Python 3, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
837063233a585bdbab129301dc33036b5bb833b0442df9d3f10c4bcf7636e8d5
|
|
| MD5 |
c688d36b2103cdf64c7e515286ecd391
|
|
| BLAKE2b-256 |
8fb56d92ffdd11afc2e1b7459436e0169e1d59d8182ed505a2e07aa9f2375aa0
|