Skip to content

TLS Requests is a powerful Python library for secure HTTP requests, offering browser-like TLS client, fingerprinting, anti-bot page bypass, and high performance.

License

Notifications You must be signed in to change notification settings

thewebscraping/tls-requests

Folders and files

NameName
Last commit message
Last commit date
Dec 30, 2024
Dec 30, 2024
Dec 14, 2024
Mar 9, 2025
Dec 11, 2024
Dec 11, 2024
Dec 5, 2024
Dec 4, 2024
Dec 14, 2024
Dec 4, 2024
Dec 30, 2024
Dec 30, 2024
Mar 6, 2025
Dec 4, 2024
Dec 11, 2024
Feb 15, 2025
Dec 11, 2024
Feb 15, 2025
Feb 15, 2025
Feb 15, 2025

Repository files navigation

TLS Requests

GitHub License CI PyPI - Version Python Version Pre-commit

Documentation

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:

>>> import tls_requests
>>> r = tls_requests.get("https://httpbin.org/get")
>>> 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

coingecko.png

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.
  • 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.

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.
  • 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:

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.