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)

Proxy Support

# HTTP proxy
response = httpmorph.get(
    'https://example.com',
    proxy='http://proxy.example.com:8080'
)

# Proxy with authentication
response = httpmorph.get(
    'https://example.com',
    proxy='http://proxy.example.com:8080',
    proxy_auth=('username', 'password')
)

# requests-compatible dict format
proxies = {
    'http': 'http://proxy.example.com:8080',
    'https': 'http://proxy.example.com:8080'
}
response = httpmorph.get('https://example.com', proxies=proxies)

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 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.2-cp313-cp313-win_amd64.whl (838.6 kB view details)

Uploaded CPython 3.13Windows x86-64

httpmorph-0.1.2-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.2-cp313-cp313-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

httpmorph-0.1.2-cp312-cp312-win_amd64.whl (838.6 kB view details)

Uploaded CPython 3.12Windows x86-64

httpmorph-0.1.2-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.2-cp312-cp312-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

httpmorph-0.1.2-cp311-cp311-win_amd64.whl (838.3 kB view details)

Uploaded CPython 3.11Windows x86-64

httpmorph-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

httpmorph-0.1.2-cp310-cp310-win_amd64.whl (838.0 kB view details)

Uploaded CPython 3.10Windows x86-64

httpmorph-0.1.2-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.2-cp310-cp310-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

httpmorph-0.1.2-cp39-cp39-win_amd64.whl (838.2 kB view details)

Uploaded CPython 3.9Windows x86-64

httpmorph-0.1.2-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.2-cp39-cp39-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

httpmorph-0.1.2-cp38-cp38-win_amd64.whl (839.6 kB view details)

Uploaded CPython 3.8Windows x86-64

httpmorph-0.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

httpmorph-0.1.2-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.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: httpmorph-0.1.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 838.6 kB
  • Tags: CPython 3.13, 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.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d8d52306bdb046379f68ae3ab489de39fdb28d751811978ee687169a6572f774
MD5 5fd3dc37285147432adb20177ea0fe31
BLAKE2b-256 4644a6e06ed3bc8838a032f221151578a2a6ff13ec7d693e6d91b846099e2f6a

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3484cebc2bb06508d66110af23476ab06c2c73f0566d165dfcf3e576511ce680
MD5 44e3b15ad1584da10ca184f8e033184f
BLAKE2b-256 28dca65e674d5d5a6c07d072fce843a7ee554ee91f3026d0f891d5e272213da4

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a11da3077ed6be27861a4392cd9783c12b7c80adee2d4cf6cae36acd76de581c
MD5 5ee6cafde12ad2470c3a3d22f8d40ce4
BLAKE2b-256 1764b848753b8c44dc3b000589afc32c7c3cce02876f7a1e1107fdf2fcd52b2f

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: httpmorph-0.1.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 838.6 kB
  • Tags: CPython 3.12, 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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 625577cc7b59a18fb9f99ebc2b23aaf1aa9543e2403f4915b948fb50dde2b6cf
MD5 3838be6ee13dc3b831d9c46edc461be0
BLAKE2b-256 f67844d3d0d3a4a4d7de1ecd2ee7cd7eddd19348fe4afec8f45c14f3e3e8637b

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0b3e2bd1995c9dd9363c153c2db17e130d70a7009ee02c8915026bd42462f4ec
MD5 2ee551b939e19252a3890e38ebd215b1
BLAKE2b-256 d01b607032ca3fe73b76f5ddd595560410ca045d66e1553b8312b0b1f0072eec

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6bf6896c04f075bef5d1999f90f841c2560f34ebf8105bd2a970830bf68037de
MD5 cdfe4b6a4643572e552b99ce8aafe190
BLAKE2b-256 50cf24dd5eeaa660bdd80409ff0f91ff4d5aea778fa8c6551a79fc6538ea819e

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: httpmorph-0.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 838.3 kB
  • Tags: CPython 3.11, 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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 02ddaec808d96bf2c0e5216c5ae5dfba8093b7cad3cf0926a21c144e793216a3
MD5 f4ac37b8c3ff634231c3fe53096562c7
BLAKE2b-256 bb271eaa4d37e1d595921159062fdf80167f1dbdeb0503e45d87b8a70699c046

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e2ae6c11566f2e9c05034355f8737f0f7322822daf3bc90c275c64a530079ea2
MD5 24f3efb4e77dd2dcab74e5c195ca21de
BLAKE2b-256 c00a76c6b159c643693903410193a877d6a3523d8c9feb57557974f8796392d9

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 93384e1729c84aba28c367f7cbb94cf0f3e5613e0b1b61d5a5ca4948bf543690
MD5 4f5caeb3bf0182c45523cb3a95b4becc
BLAKE2b-256 cedad75b85f5d1430a8c29ffbde90833b52ac88457801d4a5aa7991e2155b48e

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: httpmorph-0.1.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 838.0 kB
  • Tags: CPython 3.10, 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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e6578b7d2e41677a0f5a55d9d728bd819021081a2e38a688f9fd7e4943706a02
MD5 ce2bf6633c9438454dee86481203ffd3
BLAKE2b-256 1a55b02f3b769c6e179ce1142359dd4ced0ded7d9c92b9f60bd8226625eb93a2

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0a3dcce0cf80bbb752ed900d11bf154976c3634680e7034faeecc645c7818ab0
MD5 7bfd38edcfa2a05ce2b7ceac69f14792
BLAKE2b-256 10bba3d6be59e75703ce81137937e20862dd6dc23db3c6a95373f71fe9736f96

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1f91d4e72dfb36f257ef37fd7be2b3ce09b05c7b1d699b3c436533d72b9bd952
MD5 1aad558bd1005a42922eea1a5d1b28ea
BLAKE2b-256 6868706bc53a84025cd2316cf98fe8f2e349108bdd74c4e193de3f85034d55ad

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: httpmorph-0.1.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 838.2 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.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a7f6b0eb3bcb9bcfac738fb1dadecf077fe56bf00184b60e117e22fd52a60d69
MD5 1b4749f2ee411877e6922ea251ad9bc9
BLAKE2b-256 719c256e881301bdf931a3186abdf07f592850503283d0a4842d528875ab1df1

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dc0c97db4d071dd7f6ac23da8c39f2454b7df2f4270567066d784500b8505f1c
MD5 30a86686046eb0bf91fd3d0361d36385
BLAKE2b-256 b98efe721664e320422faed7939a666031d4edab5abdc1d3625997d0eca3303d

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 be3c48623d269fe1be5f0a43c98241797d903b72af13c78a3ba266bd5d558988
MD5 55f2c6e52f5181ee9364521afb369f72
BLAKE2b-256 cdb68acd747bee2394e5a37af49c3301396fc0fe4d57db78b04e6458974eb7df

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: httpmorph-0.1.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 839.6 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.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 0aeff52fd93000d3d754ba8de95f0391f516673f849f77523cfa45886c26ba77
MD5 f0916a6f30aaf709c2565402ab46eaa8
BLAKE2b-256 ecc697cc4811da8527cba3a00d47f346cc4ede19abee84d684be37c10c99696e

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4cb1d595612b1b0559af0ff21e903481bb52570f8ff5fe709daf7cf2db790e2f
MD5 367df66b5e7bd77300eacaea5c3c8199
BLAKE2b-256 fb3ed707c8ab414f57d8eb0c70d6f79426229dc33791fe25c24f4171b62176b1

See more details on using hashes here.

File details

Details for the file httpmorph-0.1.2-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for httpmorph-0.1.2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b0e50c9e0a1d64a6600d96da000f83a068f715e7af8558309685608d72fd478e
MD5 28968f2707cf74ad8ff04b252263c3d0
BLAKE2b-256 cc758587466a3bb78ebdb57ef58526da6c893936031509cf0e8511711e3cd760

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