TLS Requests is a powerful Python library for secure HTTP requests, offering browser-like TLS fingerprinting, anti-bot page bypass, and high performance.
To install the library, you can choose between two methods:
pip install wrapper-tls-requests
pip install git+https://github.com/thewebscraping/tls-requests.git
Start using TLS Requests with just a few lines of code:
>>> import tls_requests
>>> r = tls_requests.get("https://httpbin.org/get")
>>> r
<Response [200 OK]>
>>> r.status_code
200
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!
- Bypass TLS Fingerprinting: Mimic browser-like behaviors to navigate sophisticated anti-bot systems.
- Customizable TLS Clients: Select specific TLS fingerprints to meet your needs.
- Ideal for Developers: Build scrapers, API clients, or other custom networking tools effortlessly.
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.
Example Code:
>>> import tls_requests
>>> r = tls_requests.get('https://www.coingecko.com/')
>>> r
<Response [200]>
- Browser-like TLS Fingerprinting: Enables secure and reliable browser-mimicking connections.
- High-Performance Backend: Built on a Go-based HTTP backend for speed and efficiency.
- Synchronous & Asynchronous Support: Seamlessly switch between synchronous and asynchronous requests.
- Protocol Support: Fully compatible with HTTP/1.1 and HTTP/2.
- Strict Timeouts: Reliable timeout management for precise control over request durations.
- 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.
- File Uploads: Simplified multipart file upload support.
- Proxy Configuration: Supports Socks5, HTTP, and HTTPS proxies for enhanced privacy.
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/
Found a bug? Please open an issue.
By reporting an issue you help improve the project.
Special thanks to bogdanfinn for creating the awesome tls-client.