Skip to main content

Anti-Fingerprinting HTTP client with easy TLS fingerprint spoofing

Project description

TLS-Chameleon

TLSChameleom

Anti-Fingerprinting HTTP client that spoofs real browser TLS fingerprints with a simple, requests-like API.

🚀 Features

  • TLS Fingerprint Spoofing: Built-in profiles for Chrome, Firefox, Safari (uses curl_cffi for realistic signatures).
  • Persistent Sessions: Proper cookie handling and connection pooling (just like requests.Session).
  • Magnet Module 🧲: One-line data extraction (Emails, Tables, Forms, JSON-LD, Links).
  • Smart Static ⚡: Automatically fetch page assets (CSS/JS/Images) to mimic real browser traffic.
  • Auto-Form 📝: Find and submit forms automatically, handling hidden inputs and CSRF tokens.
  • Humanize 🧠: Built-in delays to mimic human reading/typing speed.
  • Resilience: Auto-rotation of proxies/profiles upon blocking (403/429/Cloudflare).

🆚 Why use this vs curl_cffi?

Feature Raw curl_cffi TLS-Chameleon
TLS Spoofing You must manually set impersonate="chrome110" Auto-Rotation: It likely has logic to rotate these so you don't get stuck on one.
Asset Loading You just get the HTML. mimic_assets=True: It parses the HTML and fetches CSS/JS/Images to look like a "real" browser visit (very important for some anti-bots).
Forms You must manually parse CSRF tokens and hidden fields. client.submit_form(): It finds the form, keeps the hidden tokens, and submits for you.
Data Extraction You need to use BeautifulSoup manually. Magnet Module: It has built-in extractors for emails, tables, and json_ld.

📦 Install

pip install tls-chameleon[curl]

⚡ Quick Start

1. Simple Requests (Drop-in)

from tls_chameleon import get

# One-line spoofing
r = get("https://httpbin.org/get", fingerprint="chrome_124")
print(r.json())

2. Persistent Session (Recommended)

Use Session (alias for TLSChameleon) to maintain cookies across requests:

from tls_chameleon import Session

with Session(fingerprint="chrome_120") as client:
    # First request sets cookies
    client.get("https://github.com/login")
    
    # Second request sends them back!
    r = client.get("https://github.com/settings")

3. Magnet Extraction 🧲

Don't write regex. Let Magnet do it.

r = client.get("https://example.com/contact")

emails = r.magnet.emails()        # ['support@example.com']
tables = r.magnet.tables()        # [['Row1', 'Val1'], ...]
links  = r.magnet.links()
forms  = r.magnet.get_forms()     # List of parsed forms
json_data = r.magnet.json_ld()    # Schema.org data

4. Smart Features

Mimic Real Browser Traffic (Fetches static assets in background):

client.get("https://example.com", mimic_assets=True)

Auto-Submit Forms (Handles hidden fields automatically):

# Finds <form>, fills 'user'/'pass', keeps hidden tokens, POSTs to action.
client.submit_form("https://site.com/login", {
    "username": "myuser",
    "password": "mypassword"
})

Humanize Delays:

client.human_delay(reading_speed="fast") # Sleeps randomly based on speed

🛠 API Reference

Session(fingerprint=..., site=..., ...)

  • fingerprint: "chrome_120", "firefox_120", "mobile_safari_17".
  • site: "cloudflare" or "akamai" (presets for retries/headers).
  • randomize_ciphers: True/False (shuffles cipher suite order).
  • proxies: http://user:pass@host:port

Response Object

The response object wraps curl_cffi.Response or httpx.Response but adds:

  • .magnet: Access extraction tools.
  • .json_fuzzy(): Parse broken/JSONP responses.

🤝 Contributing

Issues and Pull Requests welcome!

📜 License

MIT

🚨 Is this library failing on a specific site?

Please open an issue with the URL! I need test cases to improve the fingerprinting logic.

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

tls_chameleon-1.0.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

tls_chameleon-1.0.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file tls_chameleon-1.0.0.tar.gz.

File metadata

  • Download URL: tls_chameleon-1.0.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for tls_chameleon-1.0.0.tar.gz
Algorithm Hash digest
SHA256 96ac03dade79b20920d76ef44ed7ef86bff2882ce5150e1a6408045e9150347d
MD5 809963a64d39c548e8f73e0fed1951b3
BLAKE2b-256 5f0beb7306c4d903819b6a48e8170bc739e40dc06bcb97aa96460d89e8f63a4f

See more details on using hashes here.

File details

Details for the file tls_chameleon-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tls_chameleon-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for tls_chameleon-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 214fe57b7065b4279e7e0f612f354590ed74e2965f370cc4fd485da5098ad1a6
MD5 466e4c1e2c1a805c3d17662b5f55b3e6
BLAKE2b-256 bfd2106985ee6c8b7c612f174e9df68182160079942437d2aff39ec7dc6a1042

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