Skip to main content

A HTTP client library with JA3 spoofing capabilities

Project description

httpz

A Python HTTP client that wraps around the azuretls-client Go package, providing easy-to-use JA3 fingerprinting capabilities with an API similar to httpx.

Features

  • JA3 Fingerprinting: Easily modify the TLS fingerprint of your HTTP requests
  • Browser Emulation: Set a browser profile to match specific browser behavior
  • Ordered Headers: Control the exact order of HTTP headers for better browser emulation
  • Fallback Mode: Gracefully falls back to the requests library when the native library isn't available
  • httpx-like API: Familiar interface for users of the popular httpx library

Installation

pip install httpz-ja3

Quick Start

from httpz import Session

# Create a session
session = Session()

# Make a request
response = session.get("https://httpbin.org/get")
print(f"Status code: {response.status_code}")
print(response.json)

JA3 Fingerprinting

from httpz import Session, Browser

# Create a session
session = Session()

# Apply a specific JA3 fingerprint
ja3 = "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-21,29-23-24,0"
session.apply_ja3(ja3, browser=Browser.CHROME)

# Set custom headers in a specific order (important for fingerprinting)
session.set_ordered_headers([
    ("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"),
    ("accept-language", "en-US,en;q=0.9"),
    ("user-agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Safari/605.1.15")
])

# Make request
response = session.get("https://tls.peet.ws/api/all")

# Check the detected JA3 fingerprint
if response.status_code == 200:
    ja3_info = response.json.get('tls', {}).get('ja3', 'unknown')
    print(f"Server detected JA3: {ja3_info}")

Convenience Functions

from httpz import get_session, create_with_ja3, Browser

# Quick session creation with JA3
session = get_session(
    ja3="771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-21,29-23-24,0", 
    browser=Browser.SAFARI
)

# Ensure JA3 is applied (will raise error if azuretls not available)
session = create_with_ja3(
    ja3="771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-21,29-23-24,0", 
    browser=Browser.CHROME
)

Cookie Handling

from httpz import Session

session = Session()
response = session.get("https://httpbin.org/cookies/set?cookie1=value1")

# Access cookies
for cookie in response.cookies:
    print(f"Cookie: {cookie['name']} = {cookie['value']}")

# Make another request with the cookies
response = session.get("https://httpbin.org/cookies")
print(response.json)

Context Manager Support

from httpz import Session

with Session() as session:
    response = session.get("https://httpbin.org/get")
    print(response.json)
    # Session automatically closed when exiting the context

httpx-like Interface

If you're familiar with httpx, you'll find httpz very similar to use:

# httpx
import httpx
with httpx.Client() as client:
    response = client.get("https://httpbin.org/get")
    print(response.json())

# httpz
import httpz
with httpz.Session() as session:
    response = session.get("https://httpbin.org/get")
    print(response.json)

Building from Source

If you want to build the library from source:

git clone https://github.com/username/httpz
cd httpz
make
python -m pip install -e .

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

httpz_ja3-0.1.0.tar.gz (3.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

httpz_ja3-0.1.0-py3-none-any.whl (3.5 MB view details)

Uploaded Python 3

File details

Details for the file httpz_ja3-0.1.0.tar.gz.

File metadata

  • Download URL: httpz_ja3-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0rc2

File hashes

Hashes for httpz_ja3-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8055598da892b3368990d1764ee29226fda01ca19003a285ffdbeddf893b4feb
MD5 e630bf76106b87b4198e114bbaaf53b7
BLAKE2b-256 7602b3c84f474d86e3f3ec11965d53c253efceabd8fe3d184787ec5df0e37ef7

See more details on using hashes here.

File details

Details for the file httpz_ja3-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: httpz_ja3-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0rc2

File hashes

Hashes for httpz_ja3-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad695cfc540e082357938e82d51c84ba48a10243a144606533165ba774075919
MD5 1d07e3aca5f3ddafc94bae59b2a2f8e6
BLAKE2b-256 b39783f420c15124dcb3dcf3761e7629f8baa4a28501177e70dedc6e0a407326

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