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.1.0-py3-none-win_amd64.whl (4.1 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

httpcloak-1.1.0-py3-none-macosx_10_9_x86_64.whl (4.0 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: httpcloak-1.1.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.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 65c997d133f83d635284481a3b9a0824a6ee2048cd100e86ea4f73d2ed1fce8a
MD5 2a5752d53979b5eb78b49479fb06ee0c
BLAKE2b-256 1e904cd3f96e4133ba37387b3c1c8e11c2b467a7fab6c50355e5932d918bec8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.1.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 8ffbe1ca98dddcf1277c76ced237a75b51f16e81a2e137244500ba76cdbfa400
MD5 7a93dfb46ef96baf9b927e479c82523d
BLAKE2b-256 4d2def8cc97f0e33cddad93e86e9699463902cdb255b59031b53f35a2dbe076e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.1.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 e9883d759b1b28915aec2ed1906d3fb424eb594a88f71ef5e6ac75ec2b155ea1
MD5 d55b015389945d3be6dc8848ea975b9b
BLAKE2b-256 ae6ee9dd5e792ccdfbe81843df4d3520f37a6f862875893f6cd92aca54c5db69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a2f7ecc92455b0cb89bf26b4e40b8811f807c17e3d3a99ded8520b32bce056a
MD5 05250a34d1218d31438dd566de95c8e9
BLAKE2b-256 b9087630ecd722c90c91d30d1ccf944749fe240a5976a98b7cc8dbe4b544a1d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.1.0-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3bf735149bf20ac6b3706e497a4dc1c819609c8b826a21a9975aa2aa5f2d74c1
MD5 6b836605baa7043ecdca32b903b8f6d4
BLAKE2b-256 be12a4ddc156b6e04dfbfa59033072900eba7dcbbabe1acb7ad3a46ec9e88c9c

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