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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

httpcloak-1.1.3-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.1.3-py3-none-win_amd64.whl.

File metadata

  • Download URL: httpcloak-1.1.3-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.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 be4eee4d3ab4f887aea7e2b20d712dfccaebded48e616f2bfc24f0a3c32f2c40
MD5 7f7cc0afe2512d916ad8c7a39886002e
BLAKE2b-256 bc4144c61c5414f7b75da6ed57936e9bb1a77d29965bab7bfb040719720501b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.1.3-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6983abdad23cd385cd5bd80d9417f8d27de6d47a772f72f82b65d426240aaba8
MD5 6eca7398dd2bf6bd813520a3e4e6772d
BLAKE2b-256 023cbe82235a9110720b58c64f873a26728883e4312f311130f94267ac9f7b87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.1.3-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 bb54e41e0b17c497d99ac96fe66cf49c557f7bd9589aef3ce44a97640771ba23
MD5 adb6b152b31c5094401be81b12db27df
BLAKE2b-256 7aed0945366c385241fcc59a36c9a83514d643a17ecbef006cdc88958a0430bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.1.3-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4e2a7a5d02d85156b0fe70f2e3a5774018e2910b82c3b34043818ba19b411ca3
MD5 bdf22b64310418eb4c2d1b845d3fd92f
BLAKE2b-256 06fe33fb55ea3a5fbb2b2b92916bb162643abe55984df2af788d97ab0d9a9d0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for httpcloak-1.1.3-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9fa31ce8684675bf92c2ec609e59d521a8fef93595acac9083d9abcdf8cdb758
MD5 0c100138ec6a88889b3e014db3663c77
BLAKE2b-256 d3075997568e4fb3a0578a909a2a984456a8593eb04ce295749fe5116c848883

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