Skip to main content

A Python HTTP client focused on mimicking browser fingerprints.

Project description

httpmorph

Build codecov PyPI version License: MIT

A Python HTTP client focused on mimicking browser fingerprints.

⚠️ Work in Progress - This library is in early development. Features and API may change.

What is httpmorph?

httpmorph is a drop-in replacement for Python's requests library that uses a custom C implementation with BoringSSL instead of Python's standard HTTP stack. The primary goal is mimicking real browser TLS/HTTP fingerprints, not performance.

If you need raw speed, use httpx or aiohttp. If you need your Python script to look like Chrome, Firefox, or Safari from a fingerprinting perspective, use httpmorph.

Why httpmorph?

Many websites use TLS/HTTP fingerprinting to detect automated clients. Python's requests library has a distinctive fingerprint:

  • Uses OpenSSL with Python's default configuration
  • Specific cipher suite ordering that doesn't match browsers
  • Missing browser-specific TLS extensions (like GREASE)
  • Different HTTP/2 settings than real browsers

httpmorph addresses this by using BoringSSL (same as Chrome) and implementing exact TLS/HTTP parameters from real browsers.

Installation

pip install httpmorph

Requirements:

  • Python 3.8+
  • Supported platforms: Linux, macOS, Windows

Quick Start

import httpmorph

# Simple GET request (uses Chrome fingerprint by default)
response = httpmorph.get('https://httpbin.org/get')
print(response.text)

# Create a session with a specific browser profile
session = httpmorph.Session(browser='firefox')
response = session.get('https://httpbin.org/headers')
print(response.json())

# Session automatically handles cookies
response = session.post('https://httpbin.org/post', json={'key': 'value'})

API Compatibility

httpmorph provides a requests-compatible API:

# Module-level convenience functions
httpmorph.get(url, **kwargs)
httpmorph.post(url, data=None, json=None, **kwargs)
httpmorph.put(url, data=None, **kwargs)
httpmorph.delete(url, **kwargs)
httpmorph.head(url, **kwargs)
httpmorph.patch(url, data=None, **kwargs)
httpmorph.options(url, **kwargs)

# Session object
session = httpmorph.Session(browser='chrome')
session.get(url)
session.post(url, json={...})

# Response object
response.status_code
response.headers
response.text
response.content  # bytes
response.json()
response.raise_for_status()
response.elapsed  # timedelta

Browser Profiles

Available browser profiles:

  • chrome - Chrome 131 (default)
  • firefox - Firefox 122
  • safari - Safari 17
  • edge - Edge 122

Each profile includes:

  • Accurate User-Agent header
  • TLS cipher suites in correct order
  • TLS extensions (including GREASE for Chrome/Edge)
  • Elliptic curves
  • Signature algorithms
  • HTTP/2 SETTINGS frame parameters
  • JA3 fingerprint characteristics
# Use a specific browser profile
session = httpmorph.Session(browser='firefox')
response = session.get('https://example.com')

# View TLS information
print(f"TLS Version: {response.tls_version}")
print(f"Cipher: {response.tls_cipher}")
print(f"JA3: {response.ja3_fingerprint}")

Response Timing

Responses include detailed timing information:

response = httpmorph.get('https://example.com')

# Timing in microseconds
print(f"Connect: {response.connect_time_us / 1000:.2f}ms")
print(f"TLS handshake: {response.tls_time_us / 1000:.2f}ms")
print(f"First byte: {response.first_byte_time_us / 1000:.2f}ms")
print(f"Total: {response.total_time_us / 1000:.2f}ms")

# requests-compatible
print(f"Elapsed: {response.elapsed.total_seconds():.3f}s")

Common Use Cases

Custom Headers

headers = {'Authorization': 'Bearer token123'}
response = httpmorph.get('https://api.example.com', headers=headers)

File Uploads

files = {'file': ('report.pdf', open('report.pdf', 'rb'))}
response = httpmorph.post('https://httpbin.org/post', files=files)

Timeout Control

# Single timeout value (seconds)
response = httpmorph.get('https://example.com', timeout=5)

# Tuple: (connect_timeout, read_timeout)
response = httpmorph.get('https://example.com', timeout=(3, 10))

Authentication

# Basic authentication
response = httpmorph.get(
    'https://api.example.com',
    auth=('username', 'password')
)

Sessions with Cookies

session = httpmorph.Session()

# Cookies persist across requests
session.get('https://example.com/login')
session.post('https://example.com/form', data={'key': 'value'})

# Access cookies
print(session.cookies)

Error Handling

try:
    response = httpmorph.get('https://example.com', timeout=5)
    response.raise_for_status()
except httpmorph.Timeout:
    print("Request timed out")
except httpmorph.ConnectionError:
    print("Failed to connect")
except httpmorph.HTTPError as e:
    print(f"HTTP error: {e.response.status_code}")

Current Limitations

This library is a work in progress. Known limitations:

  • No proxy support
  • No SSL verification configuration
  • No connection pooling
  • No streaming requests/responses
  • Limited cookie handling (basic support)
  • No custom auth handlers
  • HTTP/2 support is partial

These may be addressed in future releases.

Building from Source

# 1. Clone the repository
git clone https://github.com/arman-bd/httpmorph
cd httpmorph

# 2. Build vendor dependencies (BoringSSL, nghttp2)
#    This takes 5-10 minutes on first build
bash scripts/setup_vendors.sh

# 3. Install in development mode
pip install -e ".[dev]"

# 4. Run tests
pytest tests/ -v

Platform-Specific Prerequisites

macOS:

brew install cmake ninja go

Linux (Ubuntu/Debian):

sudo apt-get install cmake ninja-build golang pkg-config autoconf automake libtool

Windows:

choco install cmake golang -y
# Also requires Visual Studio 2019+ with C++ tools

Architecture

httpmorph has three layers:

  1. C Core (src/core/) - Socket handling, TLS with BoringSSL, HTTP parsing
  2. Cython Bindings (src/bindings/) - Python interface to C code
  3. Python Wrapper (src/httpmorph/) - requests-compatible API

Browser TLS profiles are defined in src/tls/browser_profiles.c.

License

MIT License - see LICENSE file for details.

Contributing

This project is in early development. Contributions welcome, but please note the API is still evolving.

Disclaimer

This tool is for legitimate testing and development purposes only. Users are responsible for complying with website terms of service and applicable laws.

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.

httpmorph-0.1.0a1-cp313-cp313-win_amd64.whl (838.8 kB view details)

Uploaded CPython 3.13Windows x86-64

httpmorph-0.1.0a1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

httpmorph-0.1.0a1-cp313-cp313-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

httpmorph-0.1.0a1-cp312-cp312-win_amd64.whl (838.8 kB view details)

Uploaded CPython 3.12Windows x86-64

httpmorph-0.1.0a1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

httpmorph-0.1.0a1-cp312-cp312-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

httpmorph-0.1.0a1-cp311-cp311-win_amd64.whl (838.5 kB view details)

Uploaded CPython 3.11Windows x86-64

httpmorph-0.1.0a1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

httpmorph-0.1.0a1-cp311-cp311-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

httpmorph-0.1.0a1-cp310-cp310-win_amd64.whl (838.2 kB view details)

Uploaded CPython 3.10Windows x86-64

httpmorph-0.1.0a1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

httpmorph-0.1.0a1-cp310-cp310-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

httpmorph-0.1.0a1-cp39-cp39-win_amd64.whl (838.3 kB view details)

Uploaded CPython 3.9Windows x86-64

httpmorph-0.1.0a1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

httpmorph-0.1.0a1-cp39-cp39-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

httpmorph-0.1.0a1-cp38-cp38-win_amd64.whl (839.9 kB view details)

Uploaded CPython 3.8Windows x86-64

httpmorph-0.1.0a1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.7 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

httpmorph-0.1.0a1-cp38-cp38-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

Details for the file httpmorph-0.1.0a1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e4b8cb9a4a0729a821be824b893409af7c25561294f37b912938340da83d92f9
MD5 bf600101201ab75fbc46bea2a7fb621d
BLAKE2b-256 ae2cedaaa201f0ae0e0532487bae96d9657bc69dd0594c98667d1837296459b4

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4517bb7953e922343e127c4be3bb8bddcb52261c2886b91a932f38b2810a9a7f
MD5 cfed75b08c333529c063b75975040750
BLAKE2b-256 6dabf37d515edf3516208a4c261663d57cccbd746280ae4242f0ebbeea8f15b6

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a8fd453183b637aa4229a8a6e64661c7e9fe4cb3085ea740a7118ea674c5c1e
MD5 14c4c5ab24ef8a59735f00a0f6fe4b24
BLAKE2b-256 14fe3d2484f054381d093db5ba53c1cf4b52dc7006e9911b53907e6f4036f20c

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 37a68d07405db87c79efe3bfc114cc0690e77ed27fa6af27dd644816e7ce8fc6
MD5 4c9ae1bd9b7d6aeafed0500fcc86231f
BLAKE2b-256 fd1aed86f6d8bb5e6c0ba18109b34a483f158d3db0a8b121a42986324cc7acae

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 758548e595f998167f96a5040f8e5781828050c472cd954523c53455fc65bd15
MD5 94232f3278d81e61ef987b3fb7d7fe3e
BLAKE2b-256 2c3421f5671abd75c203610077f48a4157d4efe0f6fdf44ff1b94f0cb0947a04

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 482880729b99408bcbfb2b5f6b4f74e7f3cd6cad8bf7e972f2228d1487b82b60
MD5 4b5a3e9bca03488de846e319edde6045
BLAKE2b-256 7611e7d15f9769abdab0f099f970f8cc4f783b4cb6bae977289308de59967b03

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 338d678d0f6d021ef9b5d702527491ac40d222b284558043898b6dea6b1d0e95
MD5 3c79e4d67427c1537cba5e0124bf2457
BLAKE2b-256 808397de684c89c7034f3bdb56cce1a8ef2d04f4f3a252789dab37070df9c51f

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f506ad51f8356251adc3ddc864ebd4fca85489b59429b57d3aab96a93920a9d9
MD5 8262b51cbb7dc0fca27464b16ce8f638
BLAKE2b-256 9efe412853ac7ef79209ffa6fa0b4936144ad3c86edd91a38d4c6b503791fc70

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fd38701f38a889515a8f298ee8955fb01a04334f283f15b5f57710ba41fa01f2
MD5 dfd5ff01aa295c1af2088dde128444f8
BLAKE2b-256 5aea16e1180bea1e79784be05d0beb19da2b7aceb300e2b2989eb32ec7842215

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c53e0058a71ec8acd3256b2e9e8a58bcc60ef20c29a440b4f38de8e28ad9b7b5
MD5 743c9628bc1cfbb2116aca45dc767a3e
BLAKE2b-256 cc1c6d2daa95be6126eb7f6acedf8db4e4cae8de8dab2a6760fdb29e875ac966

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d48fb30b17606d14042c90d56071789798eb6f5ee04e9a49dc45036011b1dfcf
MD5 6859daf707abeff4a03fa50483605292
BLAKE2b-256 a8987788c9b8c03dfd1f80870e35992c9d1dd2bf0b1e7f7d1a9f381b1d600389

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 717b52efc695c9fa1caf47c6105d6b8b142cae09efe1fe81ccdfcff9b40f1c5c
MD5 e7570c6a047c116f8ba6fd5e5e06cc40
BLAKE2b-256 307a9c5c8e64a7eea46fd603b40abbc916ac0f90c94caa0e256f36bbb8512c2b

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: httpmorph-0.1.0a1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 838.3 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for httpmorph-0.1.0a1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 7a7805391092404507151ea3e4f08f5bb89a151d377ad5f29534e2ba213fcb50
MD5 9052236754872b7e4b08e453238bf39a
BLAKE2b-256 91ee62c4e0837be17309e3206f889b8b9dd0443b1fd488094fb303047437ae71

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 83dc202eff3fc2fec759ed37538b9e9e310b7cd9a9454363ce7e996fa4fd8cb7
MD5 f328284f38a0f75fdd87cf66e9291524
BLAKE2b-256 9855a97c1d953cc8f91f85fe8d19ee45f22b8e49a7827239a053e0320cc71655

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e9544f23cbdc93d5787274c741678d8a23fafc4c642e6fec77e81921e937dd5a
MD5 1ef5cf1b1ee60de3ecc46c8208cf8e14
BLAKE2b-256 bb89a929e4c3d27b2aee38a0ca7ce7c213d83b56625a452a5c594c1f092299c3

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: httpmorph-0.1.0a1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 839.9 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for httpmorph-0.1.0a1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 be15a442883204e24f28a6157149fc01eb7c7197647fca1c036128339fdb4ad4
MD5 d2e8443afff71e73c0fb079602b3a04d
BLAKE2b-256 29f1320fad834fcafb957ba36a6f816c84d38066a1069dbaa5e89651a8d27346

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e5db0bce4faefeb10ccf600456144732786ec9893d756de71e377952e9784c1e
MD5 11b2abee8669c020dfa46a5f42f177f9
BLAKE2b-256 70ad02803e9a5e80e52b05ea71145c145166649b05cf769fcc8d7b99ff330090

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.0a1-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.0a1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f57170deafcf364e3ddb62c5f1a7dc58a229c604eef5e72656d839e785bf2d49
MD5 7388a3869878920730b82134971ca87f
BLAKE2b-256 8c0ca9b6d86b2e9d0349b0325c9ff993a0d4216c2e69cb3289f659c8173c4461

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