<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Earn Pham</title>
    <description>The latest articles on DEV Community by Earn Pham (@earn_pham).</description>
    <link>https://dev.to/earn_pham</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2569163%2F50fdd0ef-547f-46b1-af43-7694cae524fb.png</url>
      <title>DEV Community: Earn Pham</title>
      <link>https://dev.to/earn_pham</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/earn_pham"/>
    <language>en</language>
    <item>
      <title>Must Try Open-Source Python TLS Requests: Simplify Web Scraping, Bypass Cloudflare 403 Forbidden (WAF)</title>
      <dc:creator>Earn Pham</dc:creator>
      <pubDate>Sat, 14 Dec 2024 06:39:10 +0000</pubDate>
      <link>https://dev.to/earn_pham/must-try-open-source-python-tls-requests-simplify-web-scraping-bypass-cloudflare-403-forbidden-34f6</link>
      <guid>https://dev.to/earn_pham/must-try-open-source-python-tls-requests-simplify-web-scraping-bypass-cloudflare-403-forbidden-34f6</guid>
      <description>&lt;h1&gt;
  
  
  TLS Requests
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://github.com/thewebscraping/tls-requests" rel="noopener noreferrer"&gt;&lt;strong&gt;TLS Requests&lt;/strong&gt;&lt;/a&gt; is a powerful Python library for secure HTTP requests, offering browser-like TLS fingerprinting, anti-bot bypassing, and high performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;To install the library, you can choose between two methods:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Install via PyPI&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;wrapper-tls-requests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;2. Install via GitHub Repository&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;git+https://github.com/thewebscraping/tls-requests.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Quick Start
&lt;/h2&gt;

&lt;p&gt;Start using TLS Requests with just a few lines of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tls_requests&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tls_requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://httpbin.org/get&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;         &lt;span class="c1"&gt;# Output: &amp;lt;Response [200 OK]&amp;gt;
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Output: 200
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;TLS Requests&lt;/strong&gt; is a cutting-edge HTTP client for Python, offering a feature-rich, highly configurable alternative to the popular &lt;code&gt;requests&lt;/code&gt; library.&lt;/p&gt;

&lt;p&gt;Built on top of &lt;a href="https://github.com/thewebscraping/tls-requests" rel="noopener noreferrer"&gt;&lt;strong&gt;tls-client&lt;/strong&gt;&lt;/a&gt;, it combines ease of use with advanced functionality for secure networking.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Key Benefits&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bypass TLS Fingerprinting&lt;/strong&gt;: Mimic browser-like behaviors to navigate sophisticated anti-bot systems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customizable TLS Clients&lt;/strong&gt;: Select specific TLS fingerprints to meet your needs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ideal for Developers&lt;/strong&gt;: Build scrapers, API clients, or other custom networking tools effortlessly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Use TLS Requests?
&lt;/h2&gt;

&lt;p&gt;Modern websites increasingly use &lt;a href="https://github.com/thewebscraping/tls-requests" rel="noopener noreferrer"&gt;&lt;strong&gt;TLS Fingerprinting&lt;/strong&gt;&lt;/a&gt; and anti-bot tools like Cloudflare Bot Fight Mode to block web crawlers. &lt;strong&gt;TLS Requests&lt;/strong&gt; 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.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw18xt48jy7a1uuzttd65.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw18xt48jy7a1uuzttd65.jpeg" alt="Cloudflare 403 Forbidden" width="800" height="503"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Unlocking Cloudflare Bot Fight Mode
&lt;/h3&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tls_requests&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tls_requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://www.coingecko.com/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Output: &amp;lt;Response [200]&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Key Features
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Enhanced Capabilities&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Browser-like TLS Fingerprinting&lt;/strong&gt;: Enables secure and reliable browser-mimicking connections.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High-Performance Backend&lt;/strong&gt;: Built on a Go-based HTTP backend for speed and efficiency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Synchronous &amp;amp; Asynchronous Support&lt;/strong&gt;: Seamlessly switch between synchronous and asynchronous requests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Protocol Support&lt;/strong&gt;: Fully compatible with HTTP/1.1 and HTTP/2.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strict Timeouts&lt;/strong&gt;: Reliable timeout management for precise control over request durations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Additional Features&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Internationalized Domain &amp;amp; URL Support&lt;/strong&gt;: Handles non-ASCII URLs effortlessly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cookie Management&lt;/strong&gt;: Ensures session-based cookie persistence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authentication&lt;/strong&gt;: Native support for Basic and Function authentication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Content Decoding&lt;/strong&gt;: Automatic handling of gzip and brotli-encoded responses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hooks&lt;/strong&gt;: Perfect for logging, monitoring, tracing, or pre/post-processing requests and responses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unicode Support&lt;/strong&gt;: Effortlessly process Unicode response bodies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;File Uploads&lt;/strong&gt;: Simplified multipart file upload support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Proxy Configuration&lt;/strong&gt;: Supports Socks5, HTTP, and HTTPS proxies for enhanced privacy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Documentation
&lt;/h2&gt;

&lt;p&gt;Read the full documentation at &lt;a href="https://thewebscraping.github.io/tls-requests/" rel="noopener noreferrer"&gt;&lt;strong&gt;thewebscraping.github.io/tls-requests/&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
