Skip to main content

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


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

httpcloak-1.5.0-py3-none-win_amd64.whl (4.1 MB view details)

Uploaded Python 3Windows x86-64

httpcloak-1.5.0-py3-none-manylinux_2_17_x86_64.whl (4.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

httpcloak-1.5.0-py3-none-manylinux_2_17_aarch64.whl (3.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

httpcloak-1.5.0-py3-none-macosx_11_0_arm64.whl (3.8 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

httpcloak-1.5.0-py3-none-macosx_10_9_x86_64.whl (4.1 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

Details for the file httpcloak-1.5.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: httpcloak-1.5.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 4.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for httpcloak-1.5.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 1ed13f56c776d53f728791c0ab0f77a430fbadae1cea4d1525692d7e16dc3b12
MD5 7e2886b314a95543988114ce4b0c54dc
BLAKE2b-256 9946ae164cb5fc58898cbb409125e6bc8fd45ab1d8ec0c296e30ff1e9353d822

See more details on using hashes here.

File details

Details for the file httpcloak-1.5.0-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for httpcloak-1.5.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b2a995ba5ebb4fdf54a866b7c2fbfc12b9e06d56461a5747b7c709c8c346fd83
MD5 38698c64c7cd61a529089355129308d9
BLAKE2b-256 1e1f2fac584213accd48229d8b8786ddbb9e8677be7418f0548fa8117121c9eb

See more details on using hashes here.

File details

Details for the file httpcloak-1.5.0-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for httpcloak-1.5.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 97b782e3496e172218d3b34a9599c1bb84969c1a40278d90be1a0cc4d569111b
MD5 ef8990e0a9fb26e0d4233556e1d8f48d
BLAKE2b-256 c5d18d2a73696c29a70fd28113767595f7a38d0cf586a836ba7b80fa9f9f4437

See more details on using hashes here.

File details

Details for the file httpcloak-1.5.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for httpcloak-1.5.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f729e63f535f6bbd5d6034e0625c0229b7868473608cc8b018cf02dd113ca4cf
MD5 a064c8257cc4d547f46c0ae63635e3f4
BLAKE2b-256 6290bc3a6b0f37c3751c44c548a7dc25986657d1435e349930e6757fe5814611

See more details on using hashes here.

File details

Details for the file httpcloak-1.5.0-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for httpcloak-1.5.0-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bf4470deb249d10e7ba7cc62d5f62147d72eb450a94f43defbc0f273c735fb1a
MD5 3094c019b320addc2856848d284005cb
BLAKE2b-256 49555a497b869d1712f95cacaa1ac9f8f24b0b17560853e59041706e2f36a90e

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