A powerful and lightweight Python library for making secure and reliable HTTP/TLS fingerprint requests.
Project description
TLS Requests
TLS Requests is a powerful Python library for secure HTTP requests, offering browser-like TLS client, fingerprinting, anti-bot page bypass, and high performance.
Installation
To install the library, you can choose between two methods:
1. Install via PyPI:
pip install wrapper-tls-requests
2. Install via GitHub Repository:
pip install git+https://github.com/thewebscraping/tls-requests.git
Quick Start
Start using TLS Requests with just a few lines of code. It automatically synchronizes headers based on your chosen browser identifier:
import tls_requests
# The library automatically injects matching User-Agent and Sec-CH-UA headers
r = tls_requests.get("https://httpbin.org/headers", client_identifier="chrome_133")
r.json()["headers"]["User-Agent"]
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36'
Basic automatically rotates for proxies and TLS identifiers:
import tls_requests
proxy_rotator = tls_requests.ProxyRotator([
"http://user1:pass1@proxy.example.com:8080",
"http://user2:pass2@proxy.example.com:8081",
"socks5://proxy.example.com:8082",
"proxy.example.com:8083", # defaults to http
"http://user:pass@proxy.example.com:8084|1.0|US", # weight and region support
])
r = tls_requests.get(
"https://httpbin.org/get",
proxy=proxy_rotator,
client_identifier=tls_requests.TLSIdentifierRotator()
)
r
<Response [200 OK]>
r.status_code
200
Introduction
TLS Requests is a cutting-edge HTTP client for Python, offering a feature-rich,
highly configurable alternative to the popular requests library.
Built on top of tls-client,
it combines ease of use with advanced functionality for secure networking.
Acknowledgment: A big thank you to all contributors for their support!
Key Benefits
- Bypass TLS Fingerprinting: Mimic browser-like behaviors to navigate sophisticated anti-bot systems.
- Customizable TLS Client: Select specific TLS fingerprints to meet your needs.
- Ideal for Developers: Build scrapers, API clients, or other custom networking tools effortlessly.
Why Use TLS Requests?
Modern websites increasingly use TLS Fingerprinting and anti-bot tools like Cloudflare Bot Fight Mode to block web crawlers.
TLS Requests bypass these obstacles by mimicking browser-like TLS behaviors, making it easy to scrape data or interact with websites that use sophisticated anti-bot measures.
Unlocking Cloudflare Bot Fight Mode
Example Code:
import tls_requests
r = tls_requests.get('https://www.coingecko.com/')
r
<Response [200]>
Key Features
Enhanced Capabilities
- Browser-like TLS Fingerprinting: Enables secure and reliable browser-mimicking connections.
- Dynamic Header Synchronization: Automatically extracts browser versions from
client_identifierand injects them intoUser-Agentandsec-ch-uaheaders. - High-Performance Backend: Built on a Go-based HTTP backend with Protocol Racing (Happy Eyeballs) enabled by default for faster connections.
- Synchronous & Asynchronous Support: Seamlessly switch between synchronous and asynchronous requests.
- Protocol Support: Fully compatible with HTTP/1.1, HTTP/2, and HTTP/3 (Alpha).
- Strict Timeouts: Reliable timeout management for precise control over request durations.
Additional Features
- Internationalized Domain & URL Support: Handles non-ASCII URLs effortlessly.
- Cookie Management: Ensures session-based cookie persistence.
- Authentication: Native support for Basic and Function authentication.
- Content Decoding: Automatic handling of gzip and brotli-encoded responses.
- Hooks: Perfect for logging, monitoring, tracing, or pre/post-processing requests and responses.
- Unicode Support: Effortlessly process Unicode response bodies.
- Advanced TLS Options: Support for
protocol_racing,allow_httpandstream_id. - File Uploads: Simplified multipart file upload support.
- Proxy Configuration: Supports Socks5, HTTP, and HTTPS proxies for enhanced privacy.
Documentation
Explore the full capabilities of TLS Requests in the documentation:
- Quickstart Guide: A beginner-friendly guide.
- Advanced Topics: Learn to leverage specialized features.
- Async Support: Handle high-concurrency scenarios.
- Custom TLS Configurations:
Read the documentation: thewebscraping.github.io/tls-requests/
Report Issues
Found a bug? Please open an issue.
By reporting an issue you help improve the project.
Credits
Special thanks to bogdanfinn for creating the awesome tls-client.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wrapper_tls_requests-1.2.5.tar.gz.
File metadata
- Download URL: wrapper_tls_requests-1.2.5.tar.gz
- Upload date:
- Size: 50.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
745f91183eaeba4a9c5ae9147868ecdf8ecc58c72bf1f035bd08a75dc1d4630f
|
|
| MD5 |
ef9a77ff770a557f4b3487bc05425b63
|
|
| BLAKE2b-256 |
81e219f4980c3d119fbdcee5338b9930b55962850c893e04d9f3d778322467f7
|
Provenance
The following attestation bundles were made for wrapper_tls_requests-1.2.5.tar.gz:
Publisher:
publish.yml on thewebscraping/tls-requests
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wrapper_tls_requests-1.2.5.tar.gz -
Subject digest:
745f91183eaeba4a9c5ae9147868ecdf8ecc58c72bf1f035bd08a75dc1d4630f - Sigstore transparency entry: 982766668
- Sigstore integration time:
-
Permalink:
thewebscraping/tls-requests@4500246e941c5ca0fa0f01f8610fa5727ef71ef7 -
Branch / Tag:
refs/tags/v1.2.5 - Owner: https://github.com/thewebscraping
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4500246e941c5ca0fa0f01f8610fa5727ef71ef7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file wrapper_tls_requests-1.2.5-py3-none-any.whl.
File metadata
- Download URL: wrapper_tls_requests-1.2.5-py3-none-any.whl
- Upload date:
- Size: 57.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36f297aff6102fe85bf803c67917c87664ddf1aace056032ab1455aed88fdc44
|
|
| MD5 |
3f167e32e042e2cb6ad2c12c632a0d05
|
|
| BLAKE2b-256 |
aab483491091107c9f73023e421249fee73205b40f552cf3cea3a4ef8e2507a4
|
Provenance
The following attestation bundles were made for wrapper_tls_requests-1.2.5-py3-none-any.whl:
Publisher:
publish.yml on thewebscraping/tls-requests
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wrapper_tls_requests-1.2.5-py3-none-any.whl -
Subject digest:
36f297aff6102fe85bf803c67917c87664ddf1aace056032ab1455aed88fdc44 - Sigstore transparency entry: 982766682
- Sigstore integration time:
-
Permalink:
thewebscraping/tls-requests@4500246e941c5ca0fa0f01f8610fa5727ef71ef7 -
Branch / Tag:
refs/tags/v1.2.5 - Owner: https://github.com/thewebscraping
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4500246e941c5ca0fa0f01f8610fa5727ef71ef7 -
Trigger Event:
push
-
Statement type: