     [Blog](https://scrapfly.io/blog)   /  [blocking](https://scrapfly.io/blog/tag/blocking)   /  [curl\_cffi for Web Scraping: Impersonate Chrome in Python and Fix the 403s It Doesn't](https://scrapfly.io/blog/posts/curl-cffi-web-scraping)   

# curl\_cffi for Web Scraping: Impersonate Chrome in Python and Fix the 403s It Doesn't

 by [Mayada Shaaban](https://scrapfly.io/blog/author/mayada-shaaban-90143e67) Dec 03, 2026 25 min read [\#blocking](https://scrapfly.io/blog/tag/blocking) [\#http](https://scrapfly.io/blog/tag/http) [\#python](https://scrapfly.io/blog/tag/python) 

 [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fcurl-cffi-web-scraping "Share on LinkedIn") [  ](https://x.com/intent/tweet?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fcurl-cffi-web-scraping&text=curl_cffi%20for%20Web%20Scraping%3A%20Impersonate%20Chrome%20in%20Python%20and%20Fix%20the%20403s%20It%20Doesn%27t "Share on X") [  ](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fcurl-cffi-web-scraping "Share on Facebook")    

 

 

Summarize this article with

 [  ](https://chat.openai.com/?q=Summarize%20this%20article%20and%20explain%20how%20Scrapfly%20helps%20me%20scrape%20any%20website%20at%20scale%20and%20bypass%20anti-bot%20systems%20for%20my%20use%20case%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fcurl-cffi-web-scraping) [  ](https://claude.ai/new?q=Summarize%20this%20article%20and%20explain%20how%20Scrapfly%20helps%20me%20scrape%20any%20website%20at%20scale%20and%20bypass%20anti-bot%20systems%20for%20my%20use%20case%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fcurl-cffi-web-scraping) [  ](https://x.com/i/grok?text=Summarize%20this%20article%20and%20explain%20how%20Scrapfly%20helps%20me%20scrape%20any%20website%20at%20scale%20and%20bypass%20anti-bot%20systems%20for%20my%20use%20case%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fcurl-cffi-web-scraping) [  ](https://www.perplexity.ai/search/new?q=Summarize%20this%20article%20and%20explain%20how%20Scrapfly%20helps%20me%20scrape%20any%20website%20at%20scale%20and%20bypass%20anti-bot%20systems%20for%20my%20use%20case%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fcurl-cffi-web-scraping) [  ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20article%20and%20explain%20how%20Scrapfly%20helps%20me%20scrape%20any%20website%20at%20scale%20and%20bypass%20anti-bot%20systems%20for%20my%20use%20case%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fposts%2Fcurl-cffi-web-scraping) 



         

One of the biggest challenges in scraping with Python is blocking which can be caused by a lot of different reasons. However, we can reduce many of these reasons to a single fact - our scraper connects differently compared to a web browser (Indeed's homepage gave `requests` a 403 even with a Chrome User-Agent, while curl\_cffi got the "Job Search \| Indeed" page).

The TLS handshake is a vital part of every HTTPS connection as the server sees it before any header. Everything the client sends at that step can give a scraper away, from the cipher suites and extensions in the Client Hello to the HTTP/2 settings that come right after it.

Here we'll take a look at curl\_cffi - a Python HTTP client which copies all of this from a real browser like Chrome. How can we use it for web scraping and how can we check that it really works?

We'll take a look at impersonation profiles, headers, sessions and proxies, and what to do about the 403s curl\_cffi doesn't fix.



## Key Takeaways

- The server sees the TLS handshake before any header, and Python's `requests` and `httpx` send a different JA4 than Chrome whatever headers they carry.
- The `impersonate="chrome"` profile of curl\_cffi 0.17.0 returned the same JA4, JA3N and HTTP/2 digest as a fresh Chrome 157 connection.
- Overriding only the `User-Agent` leaves curl\_cffi's Chrome 152 `Sec-Ch-Ua` in place, a pair real Chrome never sends, so let the profile set the browser headers.
- G2 and Etsy (both DataDome) and Home Depot (Akamai) still returned a 403 to curl\_cffi.
- The [Scrapfly Web Scraping API](https://scrapfly.io/products/web-scraping-api) with the [Unblocker (previously ASP)](https://scrapfly.io/products/unblocker) returned the G2, Etsy and Home Depot homepages with HTTP 200 and their normal titles.

**Get web scraping tips in your inbox**Trusted by 100K+ developers and 30K+ enterprises. Unsubscribe anytime.







## What Is curl\_cffi and Why Does Python requests Get Fingerprinted?

curl\_cffi is what we'll use to make browser-like connections in Python. It's a Python HTTP client built on curl-impersonate - a libcurl fork which copies the TLS handshake and HTTP/2 settings of a real browser. Through its familiar `requests`-style API, we get browser-grade network fingerprints without running a browser.

In the context of web scraping we mostly care about the headers we send, as that's what we see in our code. However, every request also has a connection step - the TLS handshake and the HTTP/2 SETTINGS frame - and the server sees this step before any header.

TLS is a rather complicated protocol, and we don't need to understand all of it to identify our problem, though some basics will help. At the beginning of every HTTPS connection the client and the server need to greet each other and negotiate how the connection will be secured. This is called the "Client Hello" handshake, and it lists the client's cipher suites, extensions, supported groups and ALPN protocols.

Between Chrome and `requests`, the cipher suites, the extensions and the ALPN protocols all differ.

Similarly to the values themselves, their order differs between clients too, and Python's `ssl` module has an order of its own which no header can hide.

Anti-bot systems turn these differences into fingerprints. For this, the JA3 fingerprint is often used which essentially joins the Client Hello fields into one string and hashes it. While HTTP/2 doesn't change the data we scrape, its fingerprint (a string of the SETTINGS values, window size and pseudo-header order) can still get a web scraper blocked.

We'll skip the theory behind these here - for more see our [JA3 and JA4 fingerprinting](https://scrapfly.io/blog/posts/ja3-ja4-tls-fingerprinting-guide-to-detection-and-evasion) and [TLS blocking](https://scrapfly.io/blog/posts/how-to-avoid-web-scraping-blocking-tls) guides.

curl\_cffi can be installed without a compiler as it comes with pre-compiled wheels, and it's MIT licensed. Version 0.17.0 (released on October 26, 2026) bundles libcurl 8.23.0 and curl-impersonate 2.3.1 and supports HTTP/2, HTTP/3, asyncio and WebSocket.

For the command line version, see our [curl-impersonate command line](https://scrapfly.io/blog/posts/curl-impersonate-scrape-chrome-firefox-tls-http2-fingerprint) article. For more, see our [other Python HTTP clients](https://scrapfly.io/blog/posts/best-python-http-clients) article.



## How Do You Install curl\_cffi and Send Your First Impersonated Request?

Let's see how we can use curl\_cffi for scraping in Python. All we need is `pip install curl_cffi`, `requests` imported from `curl_cffi` and the `impersonate="chrome"` argument - the API mirrors `requests`, so most scripts only need one import and one argument changed.

First, let's set up our working environment. We'll need `curl_cffi` and `parsel` (for parsing HTML):

shell

```shell
pip install curl_cffi parsel
```



curl\_cffi comes as wheels for Linux, macOS and Windows (see the [curl\_cffi GitHub repository](https://github.com/lexiforest/curl_cffi) for the full list of features). With it installed, we have everything we need to start sending impersonated requests. Let's give it a go with the [web-scraping.dev product page](https://web-scraping.dev/products):

python

```python
from curl_cffi import requests
from parsel import Selector

response = requests.get("https://web-scraping.dev/products", impersonate="chrome")
print(response.status_code)

selector = Selector(response.text)
products = selector.css(".product h3 a::text").getall()
print(len(products), "products")
print(products[0])
```



Here, we request the product page with `impersonate="chrome"` and use a parsel CSS selector to pick up the product names.

Running it prints:

text

```text
200
5 products
Box of Chocolate Candy
```



As we can see, the page came back with a 200 status code and our selector found 5 products, the first one being Box of Chocolate Candy.

Note that without the `impersonate` argument curl\_cffi doesn't look like `requests`. Instead, it sends curl's own handshake with a JA4 of its own, which we'll see in the fingerprint table in the next section.

curl\_cffi also comes with a convenient terminal command `curl-cffi` (since version 0.15), where `--impersonate` picks the profile. It's handy for quick debugging:

shell

```shell
curl-cffi get https://tools.scrapfly.io/api/fp/ja3 --impersonate chrome
```



If we copy a request as cURL from the browser's developer tools, we can also [convert a copied cURL command to curl\_cffi](https://scrapfly.io/web-scraping-tools/curl-python/curl_cffi) code with Scrapfly's converter tool.

Tested with Python 3.14.6, [curl\_cffi 0.17.0](https://pypi.org/project/curl-cffi/), requests 2.34.2, httpx 0.28.1, parsel 1.12.1, Scrapy 2.20.0, scrapy-impersonate 1.11.0 and scrapfly-sdk 1.0.0.



## Does curl\_cffi Really Match Chrome's Fingerprint? (We Checked)

To put it shortly - yes, at least for the three values we've measured, though we didn't compare the rest of the Client Hello byte by byte. With curl\_cffi 0.17.0 and `impersonate="chrome"` we got the same JA4, JA3N and HTTP/2 digest as a fresh connection from a real Chrome 157 browser.

To test this we used two Scrapfly endpoints which make it easy to see what an HTTP client sends. `https://tools.scrapfly.io/api/fp/ja3` returns the `ja3`, `ja3n_digest`, `ja4` and more, while `https://tools.scrapfly.io/api/fp/akamai` returns the `http2_digest`. Let's give both of them a go with five different Python clients (this script also needs `pip install requests httpx`):

python

```python
import httpx
import requests
from curl_cffi import requests as curl_requests

JA3_URL = "https://tools.scrapfly.io/api/fp/ja3"
HTTP2_URL = "https://tools.scrapfly.io/api/fp/akamai"

clients = {
    "requests": lambda url: requests.get(url).json(),
    "httpx": lambda url: httpx.get(url).json(),
    "curl_cffi (no impersonate)": lambda url: curl_requests.get(url).json(),
    "curl_cffi chrome136": lambda url: curl_requests.get(url, impersonate="chrome136").json(),
    "curl_cffi chrome": lambda url: curl_requests.get(url, impersonate="chrome").json(),
}

for name, get in clients.items():
    tls = get(JA3_URL)
    print(name)
    print("  ja4:", tls["ja4"])
    print("  ja3n:", tls["ja3n_digest"])
    if name.startswith("curl_cffi"):
        print("  http2:", get(HTTP2_URL)["http2_digest"])
```



For each of the five we print the JA4 and JA3N, plus the HTTP/2 digest for the curl\_cffi ones. Here's what it printed in our run. The `requests` and `httpx` values depend on the OpenSSL build behind your Python, so yours can differ, here and in the table below:

text

```text
requests
  ja4: t13d1712ht_ab0a1bf427ad_882d495ac381
  ja3n: 55e4aa02438ea2113186c76eb519ab2a
httpx
  ja4: t13d1712ht_ab0a1bf427ad_8e6e362c5eac
  ja3n: 3ff5fd1bd2637a180e8531a9d3fd51ce
curl_cffi (no impersonate)
  ja4: t13d2712h2_b4f9224df7c1_cbb9361b6bf9
  ja3n: b30ab5aa8e8a6ff9e9be1ed2dd9f5100
  http2: bd300f7032ed67a1d62a3f1f108e3a57
curl_cffi chrome136
  ja4: t13d1516h2_8daaf6152771_d8a2da3f94cd
  ja3n: dcefaf3f0e71d260d19dc1d0749c9278
  http2: 52d84b11737d980aef856699f885ca86
curl_cffi chrome
  ja4: t13d1517h2_8daaf6152771_cb7bf5808d99
  ja3n: 0ed47781e19fcbb7e1d0f32c371716a1
  http2: 52d84b11737d980aef856699f885ca86
```



For the Chrome 157 row in the table below, we opened the same two endpoints in Chrome 157 on macOS, in a fresh browser context. Our [JA3/JA4 fingerprint tool](https://scrapfly.io/web-scraping-tools/ja3-fingerprint) and [HTTP/2 fingerprint tool](https://scrapfly.io/web-scraping-tools/http2-fingerprint) show the same data in a nicer view, so you can try them in your own browser too.

| Client | JA4 | HTTP version | Same JA4 as Chrome 157? |
|---|---|---|---|
| Chrome 157 (real) | t13d1517h2\_8daaf6152771\_cb7bf5808d99 | HTTP/2 | Reference |
| curl\_cffi `chrome` | t13d1517h2\_8daaf6152771\_cb7bf5808d99 | HTTP/2 | Yes |
| curl\_cffi `chrome136` | t13d1516h2\_8daaf6152771\_d8a2da3f94cd | HTTP/2 | No |
| curl\_cffi, no impersonate | t13d2712h2\_b4f9224df7c1\_cbb9361b6bf9 | HTTP/2 | No |
| requests 2.34 | t13d1712ht\_ab0a1bf427ad\_882d495ac381 | HTTP/1.1 | No |
| httpx 0.28 | t13d1712ht\_ab0a1bf427ad\_8e6e362c5eac | HTTP/1.1 | No |

As we can see, only the `chrome` profile lands on the same JA4 as Chrome 157. Chrome's JA3N `0ed47781e19fcbb7e1d0f32c371716a1` and HTTP/2 digest `52d84b11737d980aef856699f885ca86` match it too - meaning curl\_cffi sends the same SETTINGS values and pseudo-header order as the browser! For more on the HTTP/2 side, see our [HTTP/2 and HTTP/3 fingerprinting guide](https://scrapfly.io/blog/posts/http2-http3-fingerprinting-guide).

Further, we have the `chrome136` row. This pinned profile sends one extension fewer (`0xca34`) and three fewer signature algorithms than `chrome`, while its HTTP/2 digest is the same. Not every older profile is going to fail like this, though it's a good example of why it's worth checking what we actually send!

We might notice that the raw JA3 hash isn't part of this comparison. It changed between connections for both Chrome and curl\_cffi, as Chrome shuffles its TLS extension order per connection while JA3N and JA4 sort the extensions first. In other words, if we compared raw JA3 hashes our impersonation would look broken even when it's working just fine.

Note that reloading the page in the same Chrome tab won't give us a fresh handshake, unlike a new incognito window or a fresh browser profile. Chrome resumes the earlier TLS session and adds a `pre_shared_key` extension, and its JA4 became `t13d1518h2_8daaf6152771_e2d80978ab2e`.



## Which impersonate Target Should You Use?

We usually recommend starting with `impersonate="chrome"` and keeping curl\_cffi updated. Pinning a numbered profile only makes sense when a site needs a fingerprint that doesn't change between runs. The aliases resolve to the newest profile our installed release ships, and we can print what they point to:

python

```python
import curl_cffi
from curl_cffi.requests.impersonate import DEFAULT_CHROME, DEFAULT_FIREFOX, DEFAULT_SAFARI

print("curl_cffi", curl_cffi.__version__)
print("chrome ->", DEFAULT_CHROME)
print("firefox ->", DEFAULT_FIREFOX)
print("safari ->", DEFAULT_SAFARI)
```



Which prints the profile each alias points to on our curl\_cffi 0.17.0 install:

text

```text
curl_cffi 0.17.0
chrome -> chrome152
firefox -> firefox155
safari -> safari270
```



As we can see, `chrome` resolves to `chrome152` while the Chrome we tested was already at 157, and yet this is the profile that matched Chrome 157 in our fingerprint check above! In other words, we should judge a profile by what it sends, not by its version number.

| Alias | Resolves to in 0.17.0 | Use it for |
|---|---|---|
| `chrome` | `chrome152` | Default for most scrapers |
| `firefox` | `firefox155` | Looking like current Firefox |
| `safari` | `safari270` | Looking like current Safari |
| `edge` | `edge101` | Check its fingerprint first, otherwise use `chrome` |

The `edge` alias is a bit different, as it points at an Edge 101 profile and Edge 101 came out back in 2022. We didn't measure it against a current Edge, and if you need to look like Edge you should run it through the same endpoints first.

In total, curl\_cffi 0.17.0 lists 53 targets, including mobile ones like `chrome131_android` and `safari18_0_ios`, and even `tor145`. For the full list, see the [curl\_cffi documentation](https://curl-cffi.readthedocs.io/en/latest/). A mobile profile can be a deliberate choice too, as some sites treat Android traffic differently. In that case, the User-Agent and platform we send must stay consistent with it.

Finally, curl\_cffi also accepts custom JA3 and Akamai strings. That being said, for most scrapers running `pip install -U curl_cffi` after a major Chrome release is enough.



## How Do You Keep Headers Consistent With the Impersonated Browser?

When web scraping we want our scraper to appear as one web browser. With curl\_cffi, we keep headers consistent by letting it set the browser headers and not overriding the `User-Agent` on its own.

Let's take a look at the headers curl\_cffi sends for us with `impersonate="chrome"`, and at what changes once we set an older Chrome 120 `User-Agent` ourselves through the `headers` argument:

python

```python
from curl_cffi import requests

URL = "https://httpbin.dev/headers"
custom_ua = (
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
    "(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
)

for label, headers in [("default", {}), ("custom UA", {"User-Agent": custom_ua})]:
    sent = requests.get(URL, impersonate="chrome", headers=headers).json()["headers"]
    print(label)
    for name in ["User-Agent", "Sec-Ch-Ua", "Sec-Ch-Ua-Platform", "Accept-Language"]:
        print(f"  {name}:", sent[name][0])
```



In this example we're using the [httpbin.dev/headers](https://httpbin.dev/headers) testing endpoint, which returns the headers it received as the response body. Running it once with default headers and once with our custom `User-Agent` prints:

text

```text
default
  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36
  Sec-Ch-Ua: "Chromium";v="152", "Not?A_Brand";v="24", "Google Chrome";v="152"
  Sec-Ch-Ua-Platform: "Windows"
  Accept-Language: en-US,en;q=0.9
custom UA
  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
  Sec-Ch-Ua: "Chromium";v="152", "Not?A_Brand";v="24", "Google Chrome";v="152"
  Sec-Ch-Ua-Platform: "Windows"
  Accept-Language: en-US,en;q=0.9
```



As you can see above, we used a custom `User-Agent` for the second request, while `Sec-Ch-Ua` remains generated by curl\_cffi. Chrome 120 next to Chrome 152 is a pair real Chrome never sends! Same with the platform - a Linux `User-Agent` on this Windows profile would be a mismatch too.

That being said, adding a `Referer`, an API token or a different `Accept-Language` locale is fine. For a different identity, we just switch the profile!

[How Headers Are Used to Block Web Scrapers and How to Fix ItIntroduction to web scraping headers - what do they mean, how to configure them in web scrapers and how to avoid being blocked.](https://scrapfly.io/blog/posts/how-to-avoid-web-scraping-blocking-headers)



## How Do You Use Sessions, Cookies, Async and Proxies in curl\_cffi?

Without a session, every time we call `requests.get()` we connect with the server and only then exchange our request and response. A real browser keeps one connection and one cookie jar per website instead.

To optimize this exchange curl\_cffi lets us establish a session through `requests.Session(impersonate="chrome")`, which keeps our cookies as well. For concurrency it has `AsyncSession` and for routing the `proxy` or `proxies` argument - all three of which keep the impersonated fingerprint!

### Sessions and cookies

Using a `Session` not only reuses our connection, but also provides some convenient shortcuts like keeping cookies between requests. Here, we use it as a context manager to set a cookie through httpbin.dev and read it back:

python

```python
from curl_cffi import requests

with requests.Session(impersonate="chrome") as session:
    session.get("https://httpbin.dev/cookies/set?foo=bar")
    response = session.get("https://httpbin.dev/cookies")
    print(response.json())
    print(dict(session.cookies))
```



Which prints the same cookie twice:

text

```text
{'foo': 'bar'}
{'foo': 'bar'}
```



The first line is httpbin.dev echoing the cookie our second request sent, and the second one comes from the session's own cookie jar.

Cookies set by anti-bot systems are a bit different though, as they're often tied to the fingerprint and IP address that earned them. We should only reuse those with the same impersonation profile and exit IP.

[How to Handle Cookies in Web ScrapingIntroduction to cookies in web scraping. What are they and how to take advantage of cookie process to authenticate or set website preferences.](https://scrapfly.io/blog/posts/how-to-handle-cookies-in-web-scraping)

### Concurrent requests with AsyncSession

To speed up our scraper we can use asynchronous python as well, as web scraping is very connection intensive. For this curl\_cffi has `AsyncSession`. It takes the same `impersonate` argument and works with `asyncio.gather` too. Let's give it a go with three product pages. We'll also add a semaphore of two, as rate limits still apply to us - more requests per second from one IP is something a correct handshake won't hide:

python

```python
import asyncio
from curl_cffi import AsyncSession

URLS = [f"https://web-scraping.dev/products?page={page}" for page in range(1, 4)]

async def fetch(session, semaphore, url):
    async with semaphore:
        response = await session.get(url)
        return url, response.status_code

async def main():
    semaphore = asyncio.Semaphore(2)
    async with AsyncSession(impersonate="chrome") as session:
        results = await asyncio.gather(*(fetch(session, semaphore, url) for url in URLS))
    for url, status in results:
        print(status, url)

asyncio.run(main())
```



Running it prints:

text

```text
200 https://web-scraping.dev/products?page=1
200 https://web-scraping.dev/products?page=2
200 https://web-scraping.dev/products?page=3
```



Just like that, all three product pages returned a `200`!

### Proxies

When scraping at scale we want to spread our connections over proxies too. Just like `requests`, curl\_cffi takes a proxy as a URL through the `proxy` argument or as a dict through `proxies={"https": ...}`. According to the docs SOCKS proxy URLs work as well, though we haven't tested those.

python

```python
import os
from curl_cffi import requests

proxy = os.environ["PROXY_URL"]  # e.g. http://user:pass@host:port

response = requests.get(
    "https://httpbin.dev/headers",
    impersonate="chrome",
    proxy=proxy,  # or proxies={"https": proxy}
)
print(response.status_code, response.json()["headers"]["Sec-Ch-Ua"][0])
```



The URL comes from an environment variable, so there are no credentials in our code. Through a local test proxy with basic auth (not a commercial one) we get:

text

```text
200 "Chromium";v="152", "Not?A_Brand";v="24", "Google Chrome";v="152"
```



A JA4 check gave the same `t13d1517h2_8daaf6152771_cb7bf5808d99` with both arguments too. The TLS handshake just passes through the proxy tunnel!

If the password in `PROXY_URL` is wrong though, the script fails at the proxy:

text

```text
curl_cffi.requests.exceptions.ConnectionError: Failed to perform, curl: (7) CONNECT tunnel failed, response 407. See https://curl.se/libcurl/c/libcurl-errors.html first for more details.
```



For rotation in async code, we pass a different proxy to each call. A datacenter IP still looks like a datacenter though, however good the fingerprint is.

[How to Rotate Proxies in Web ScrapingIn this article we explore proxy rotation. How does it affect web scraping success and blocking rates and how can we smartly distribute our traffic through a pool of proxies for the best results.](https://scrapfly.io/blog/posts/how-to-rotate-proxies-in-web-scraping)



Scrapfly

#### Need to bypass anti-bot protection?

Scrapfly's Unblocker handles Cloudflare, DataDome, and more — automatically.

[Try Free →](https://scrapfly.io/register)

## How Do You Use curl\_cffi With Scrapy?

To use curl\_cffi with Scrapy all we have to do is install `scrapy-impersonate`, replace the `http` and `https` download handlers, switch to the asyncio reactor and set `meta={"impersonate": "chrome"}` on our requests. That's because by default Scrapy connects through Twisted's own TLS stack. This handler swaps it out for curl\_cffi!

[scrapy-impersonate](https://pypi.org/project/scrapy-impersonate/) 1.11.0 requires curl\_cffi 0.17.0+ and Scrapy 2.13.4+ and can be installed through the `pip install` command:

shell

```shell
pip install scrapy-impersonate
```



Let's see how a spider for the web-scraping.dev product page looks with these changes:

python

```python
import scrapy


class ProductsSpider(scrapy.Spider):
    name = "products"
    custom_settings = {
        "DOWNLOAD_HANDLERS": {
            "http": "scrapy_impersonate.ImpersonateDownloadHandler",
            "https": "scrapy_impersonate.ImpersonateDownloadHandler",
        },
        "TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor",
        "USER_AGENT": "",
    }

    async def start(self):
        yield scrapy.Request(
            "https://web-scraping.dev/products",
            meta={"impersonate": "chrome"},
        )

    def parse(self, response):
        for product in response.css(".product"):
            yield {
                "name": product.css("h3 a::text").get(),
                "price": product.css(".price::text").get(),
            }
```



If we run it with `scrapy runspider products_spider.py -O products.jsonl`, the log shows `Crawled (200) <GET https://web-scraping.dev/products> (referer: None) ['impersonate']` and the file gets 5 items:

text

```text
{"name": "Box of Chocolate Candy", "price": "24.99"}
{"name": "Dark Red Energy Potion", "price": "4.99"}
{"name": "Teal Energy Potion", "price": "4.99"}
{"name": "Red Energy Potion", "price": "4.99"}
{"name": "Blue Energy Potion", "price": "4.99"}
```



Note the empty `USER_AGENT` setting - it's the same header trap as in the headers section above. Without it, our request went out with `Scrapy/2.20.0 (+https://scrapy.org)` as the User-Agent right next to a Chrome 152 `Sec-Ch-Ua`. With the setting empty, the request carried the Chrome User-Agent instead.

We also use `async def start()` (added in Scrapy 2.13) instead of `start_requests()`, as a `start_requests()` version of this spider crawled 0 pages on Scrapy 2.20.

[Web Scraping With Scrapy: The Complete Guide in 2026Build and run a Scrapy 2.18 project with async start(), pagination, selector tests, item validation, pipelines, and JSON Lines export.](https://scrapfly.io/blog/posts/web-scraping-with-scrapy)



## Why Does curl\_cffi Still Get a 403?

Unfortunately, the TLS handshake is just one of the things a website checks, so curl\_cffi can still get a 403.

Let's see how often that happens. We sent one request with `requests` (Chrome User-Agent) and one with curl\_cffi (`impersonate="chrome"`) to 12 homepages, all from the same IP. These six stood out:

| Site | requests + Chrome UA | curl\_cffi `chrome` | What answered |
|---|---|---|---|
| Lowe's | 200, "Access Denied" page | 200, homepage | Block page, vendor not identified |
| Best Buy | Timed out at 25 s | 200, country selector page | Undetermined |
| Indeed | 403 | 200, homepage | Cloudflare challenge (requests only) |
| G2 | 403 | 403 | DataDome |
| Etsy | 403 | 403 | DataDome |
| Home Depot | 403 | 403 | Akamai "Access Denied" |

Only 3 of the 12 sites treated the two clients differently. Zillow, Walmart, Nike, Costco, Ticketmaster and nowsecure.nl let both clients in. So, a 200 from a test site like `nowsecure.nl` proves nothing on its own!

Note that the clients differ in headers and connections too, so none of the 3 differences is a proven TLS bypass.

Interestingly, each 403 told us who blocked it, which we can check in our own blocked responses as well. Here are the headers, cookies and titles that gave them away (trimmed):

text

```text
Indeed (requests)  403  cf-mitigated: challenge   server: cloudflare    cookies: __cf_bm
G2                 403  x-datadome: protected     server: cloudflare    cookies: datadome; __cf_bm
Etsy               403  x-datadome: protected     server: DataDome      cookies: datadome; exp_ebid
Home Depot         403  server: AkamaiGHost       <title>Access Denied</title>
```



As we can see, [Cloudflare](https://scrapfly.io/blog/posts/how-to-bypass-cloudflare-anti-scraping) marks its challenge with the `cf-mitigated` header and [DataDome](https://scrapfly.io/blog/posts/how-to-bypass-datadome-anti-scraping) sends `x-datadome: protected` along with a `datadome` cookie. Akamai is easy to spot too, as its edge answers as `AkamaiGHost` with an "Access Denied" page.

Note that Lowe's answered `requests` with HTTP 200 and a block page. So we should always check the body too!

So, what else can get curl\_cffi blocked besides the handshake? There are a few things to keep an eye on here.

Firstly, some websites answer with a JavaScript challenge page, which no HTTP client can get past as none of them run JavaScript. In other words, for a 403 with a challenge page we need a browser or a managed API instead.

Further, IP reputation can give us away as well. When scraping we want to avoid IPs with metadata that might indicate non-human connections (like IPs owned by a datacenter), so the same fingerprint might pass from a home network and fail from a cloud server. Instead, we should aim for residential or mobile IPs which make the connection appear much more human.

Then, cookies can also give us away. Some websites tie session cookies to the browser and platform they were issued to, which can break long running scrapers - one reply in an [r/webscraping thread](https://www.reddit.com/r/webscraping/comments/1tqtqct/curl_cffis_tlsspoofing_detected_by_cloudflare/) about a curl\_cffi scraper that started getting 403s after a year described exactly this.

Unfortunately, since web browsers change rapidly impersonation profiles can lag behind too - our `chrome136` profile from earlier had a different JA4 than Chrome 157, so it's worth checking what we're actually sending.

Finally, sometimes it's the headers that give us away even with a perfect handshake - an overridden User-Agent or Scrapy's default one. That's why our spider sets an empty `USER_AGENT`.



## What Should You Do When curl\_cffi Is Not Enough?

What if curl\_cffi still gets blocked? Then it's time to move up a layer. Each step adds cost and latency though, so it's only worth going as far as the site needs:

| Step | What it fixes |
|---|---|
| curl\_cffi | TLS and HTTP/2 fingerprint |
| curl\_cffi + residential proxies + session hygiene | IP reputation and cookies |
| Stealth browser such as [Nodriver](https://scrapfly.io/blog/posts/nodriver-tutorial) | JavaScript challenges |
| Web Scraping API with the Unblocker | All of the above, maintained for you |

The last step is the [Scrapfly Web Scraping API](https://scrapfly.io/products/web-scraping-api) with the [Unblocker (previously ASP)](https://scrapfly.io/products/unblocker). We sent it the three homepages that gave curl\_cffi a 403 (Etsy, G2 and Home Depot) with `unblocker=True` and `country="us"`. All three came back with HTTP 200 and their normal titles: "Etsy - Shop for handmade, vintage, custom, and unique gifts for everyone", "Business Software and Services Reviews \| G2" and "The Home Depot".

That's one request each, so it's not a success rate. With the Python SDK (`pip install scrapfly-sdk`), it looks like this:

python

```python
import os
from scrapfly import ScrapflyClient, ScrapeConfig

client = ScrapflyClient(key=os.environ["SCRAPFLY_KEY"])

result = client.scrape(ScrapeConfig(
    "https://web-scraping.dev/products",
    unblocker=True,  # older code calls this asp=True
    country="us",
))
print(result.upstream_status_code)
print(result.selector.css("title::text").get())
```



Running it prints:

text

```text
200
web-scraping.dev product page 1
```





## Power Up With Scrapfly



As you can see, the connection fingerprint is only one part of web scraper blocking and keeping impersonation profiles, headers, proxies and cookies in line can be a huge time sink. For this, Scrapfly's [Web Scraping API](https://scrapfly.io/products/web-scraping-api) comes fully configured to access even the hardest to access targets.

Scrapfly supports [javascript rendering](https://scrapfly.io/docs/scrape-api/javascript-rendering) via a cloud browser pool, [anti scraping protection bypass](https://scrapfly.io/docs/scrape-api/unblocker) for accessing even the most well guarded targets, [residential proxies](https://scrapfly.io/docs/scrape-api/proxy) for accessing geographically restricted content and much more!



### Power your scraping with Scrapfly

Forget about getting blocked. Scrapfly handles anti-bot bypasses, browser rendering, and proxy rotation so you can focus on the data.



[Try for FREE!](https://scrapfly.io/register)



## FAQ

Is curl\_cffi faster than requests?

The project's own [benchmarks](https://github.com/lexiforest/curl_cffi/tree/main/benchmark) put curl\_cffi on par with aiohttp and pycurl and ahead of requests and httpx. That being said it depends on each individual scraper and how many requests it sends to a single host. Connection reuse and HTTP/2 only help when there are many of them, which is why our examples above use `Session` and `AsyncSession`.







Does curl\_cffi run JavaScript?

No, curl\_cffi is essentially the opposite of a headless browser - it only replicates the browser's connection (the TLS and HTTP2 handshake) and never runs the page's javascript. However, many websites use javascript challenges or load their data on page load, so a real browser or a rendering API is still needed for those. We got lucky with the Indeed homepage earlier as Cloudflare didn't serve a challenge at all, but if it had curl\_cffi couldn't have solved it.







Is curl\_cffi still worth using in 2026?

Yes, especially for scraping API endpoints and server-rendered pages, as these often only look at the connection handshake. It won't solve challenge-based protection, but the project is MIT licensed and still actively released - to check which version we have:

python

```python
import curl_cffi
print(curl_cffi.__version__)
```



This prints `0.17.0` for us, which is the October 2026 release. Note that Chrome updates often, so it's worth updating curl\_cffi after each major release to keep the `chrome` target up to date!







What is the difference between curl\_cffi and curl-impersonate?

curl-impersonate is a patched curl build that comes with a command line tool, while curl\_cffi is the Python binding that uses it. For more on the command line side, see our [curl-impersonate guide](https://scrapfly.io/blog/posts/curl-impersonate-scrape-chrome-firefox-tls-http2-fingerprint).









## Conclusion

In this article we've taken a look at curl\_cffi - a Python HTTP client that can impersonate web browser connections. We compared its fingerprint to a real Chrome 157 and scraped web-scraping.dev with `impersonate="chrome"` and consistent headers. We've also covered how sessions and proxies can help with cookies and IPs and how scrapy-impersonate brings all of this to Scrapy.

Unfortunately, DataDome and Akamai still blocked curl\_cffi in our test, so for these we'd need a browser or a managed API. These protections constantly evolve and change with each web browser iteration, so it's a perfect place for an abstraction layer! The [Scrapfly Web Scraping API](https://scrapfly.io/products/web-scraping-api) with the Unblocker takes care of fingerprints, proxies and challenges for us.



Legal Disclaimer and Precautions

This tutorial covers popular web scraping techniques for education. Interacting with public servers requires diligence and respect:

- Do not scrape at rates that could damage the website.
- Do not scrape data that's not available publicly.
- Do not store PII of EU citizens protected by GDPR.
- Do not repurpose *entire* public datasets which can be illegal in some countries.

Scrapfly does not offer legal advice but these are good general rules to follow. For more you should consult a lawyer.

 

   [  Add as a preferred source ](https://google.com/preferences/source?q=scrapfly.io) Table of Contents















 

  Table of Contents

- [Key Takeaways](#key-takeaways)
- [What Is curl\_cffi and Why Does Python requests Get Fingerprinted?](#what-is-curl-cffi-and-why-does-python-requests-get-fingerprinted)
- [How Do You Install curl\_cffi and Send Your First Impersonated Request?](#how-do-you-install-curl-cffi-and-send-your-first-impersonated-request)
- [Does curl\_cffi Really Match Chrome's Fingerprint? (We Checked)](#does-curl-cffi-really-match-chrome-s-fingerprint-we-checked)
- [Which impersonate Target Should You Use?](#which-impersonate-target-should-you-use)
- [How Do You Keep Headers Consistent With the Impersonated Browser?](#how-do-you-keep-headers-consistent-with-the-impersonated-browser)
- [How Do You Use Sessions, Cookies, Async and Proxies in curl\_cffi?](#how-do-you-use-sessions-cookies-async-and-proxies-in-curl-cffi)
- [Sessions and cookies](#sessions-and-cookies)
- [Concurrent requests with AsyncSession](#concurrent-requests-with-asyncsession)
- [Proxies](#proxies)
- [How Do You Use curl\_cffi With Scrapy?](#how-do-you-use-curl-cffi-with-scrapy)
- [Why Does curl\_cffi Still Get a 403?](#why-does-curl-cffi-still-get-a-403)
- [What Should You Do When curl\_cffi Is Not Enough?](#what-should-you-do-when-curl-cffi-is-not-enough)
- [Power Up With Scrapfly](#power-up-with-scrapfly)
- [FAQ](#faq)
- [Conclusion](#conclusion)
 
    Join the Newsletter  Get monthly web scraping insights 

 

  



Scale Your Web Scraping

Anti-bot bypass, browser rendering, and rotating proxies, all in one API. Start with 1,000 free credits.

  No credit card required  1,000 free API credits  Anti-bot bypass included 

 [Start Free](https://scrapfly.io/register) [View Docs](https://scrapfly.io/docs/onboarding) 

 Not ready? [Get our newsletter](#newsletter-modal) instead. 

 

 

## Related Articles

 [     

 python xpath 

### Web Scraping With Scrapy: The Complete Guide in 2026

Build and run a Scrapy 2.18 project with async start(), pagination, selector tests, item validation, pipelines, and JSON...

 

 ](https://scrapfly.io/blog/posts/web-scraping-with-scrapy) [     

 blocking playwright 

### Bypass Proxy Detection with Browser Fingerprint Impersonation

Stop proxy blocks with browser fingerprint impersonation using this guide for Playwright, Selenium, curl-impersonate &amp; S...

 

 ](https://scrapfly.io/blog/posts/bypass-proxy-detection-with-browser-fingerprint-impersonation) [     

 python headless-browser 

### 9 Best Scrapy Extensions and Middlewares for 2026

Nine Scrapy extensions tested against Scrapy 2.18, covering rendering, TLS fingerprints, proxies, extraction, shared que...

 

 ](https://scrapfly.io/blog/posts/best-scrapy-extensions-middlewares) 

  

## Related Questions

- [ Q How to pass data between scrapy callbacks in Scrapy? ](https://scrapfly.io/blog/answers/how-to-pass-data-between-scrapy-callbacks)
- [ Q How to pass custom parameters to scrapy spiders? ](https://scrapfly.io/blog/answers/how-to-pass-parameters-to-scrapy-spiders-cli)
- [ Q How to pass data from start\_requests to parse callbacks in scrapy? ](https://scrapfly.io/blog/answers/how-to-pass-data-from-start-request-to-callbacks-scrapy)
- [ Q How to fix Python requests ReadTimeout error? ](https://scrapfly.io/blog/answers/python-requests-exception-readtimeout)
 
  



   



 Bypass anti-bot protection automatically, **1,000 free credits** [Start Free](https://scrapfly.io/register)