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

Uploaded Python 3Windows x86-64

httpcloak-1.0.11-py3-none-manylinux_2_17_x86_64.whl (3.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

httpcloak-1.0.11-py3-none-manylinux_2_17_aarch64.whl (3.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

httpcloak-1.0.11-py3-none-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

httpcloak-1.0.11-py3-none-macosx_10_9_x86_64.whl (3.7 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: httpcloak-1.0.11-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

Hashes for httpcloak-1.0.11-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 7e0837595862605980b64f8e300a52b49e05baa89ba7e551819d41cc9ce442e1
MD5 1f6dbd86d87e4d356627d4a13f5ed6cf
BLAKE2b-256 026bff9db455c22a37794c0f538d580a14345714d57cba8146ec21b60c2a3fbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.0.11-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 801df57b0dcd0ea94d902c1cde0c2182a906ba7c2738b1fde66b66f2efdf7dee
MD5 b3cf84238c01a9e3d7f84fdc8e0f48df
BLAKE2b-256 2416802aee4a97a540e90db3966dea9aeb191c0f3496ad703edc3b72f7041ac7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.0.11-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 e978d4c123077ab95ec671f5d0dfb3b7ea7fc1cd2c8c93e4ea19a69ea4961520
MD5 ac2692223a3f4ad6ea455cf62868ead4
BLAKE2b-256 150118bb344e2aaaefdef4644f4d0e16ca15d8cdf0b2e96fbc7f1135e3416e5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.0.11-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aefe51c76bc9d154f9aa3abf9a905fe930d4b39f2dc510f5f61137ff1048a916
MD5 0777bc0e9114b628c7e3d7dd31f28ab0
BLAKE2b-256 bc25794512ce6b28902ff5fb7311fb15cc5f17cc453e5919ec9bb20c8d5f9c2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.0.11-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 47b75fcb54cbe214da2399a9edd9a138fe2320330bcb2435ebd2cce27d2d2990
MD5 fc10921b55fab13637f38fb2d8477ecd
BLAKE2b-256 de372269ee4353551de45357be2329775a65b6323ff6a76cf6b6e316cbf8dd08

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