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

Uploaded Python 3Windows x86-64

httpcloak-1.0.12-py3-none-manylinux_2_17_x86_64.whl (4.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

httpcloak-1.0.12-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.0.12-py3-none-win_amd64.whl.

File metadata

  • Download URL: httpcloak-1.0.12-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.0.12-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 9613b30c15651359e505278cd4892fee3ed91bf9036803ae9b8285c2da19dbcc
MD5 1b2fc406e01b20a9a590123c26f4829d
BLAKE2b-256 26194f6dfef025d84b629b24806853feae9f3b9120feb0d94d19fa0c153ba707

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.0.12-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6c5ff6cf6b37128eaee0c2b26dd96e97ac618365a21b2f774d60e4a797688282
MD5 e566c80d2db68a799562220c513dce4f
BLAKE2b-256 95cc7ca149c1393247f09f9d1ab6390feca3501212204f8f0e0a38b7c0412ed1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.0.12-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 071dc8534db5397bbb862e3a8ed5f61ef3379f1a100b3d02dc57c817e46fdfb8
MD5 646df38c594ad108e65201200e6a9ff1
BLAKE2b-256 9762d4551629c9dc31aef085d7de0c35bee3b7af4038f87d15f2ab66a6685164

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.0.12-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d0f9dbf372eab9c92ab9d3ef70fb6afbb7f24bf44bfc9539224102ecc4fee4ed
MD5 0e8f496d57aff634603c5d2e64a6bee5
BLAKE2b-256 f458f31a684cdd5d1470c74322a32d13fac59ea6b0b6f4778e1391d275c9d0ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.0.12-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 470af890c699eaf5813aed52e32c7ada46c131f50a49e00e7755e9b1d458e7ba
MD5 875bd96cbb0cd9ec0b0256487a4de2b4
BLAKE2b-256 d22da4b129f2d71dc0ab0e530c14344882f45c2d3588a3eb3ba87caad5d3abd7

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