NEWStandard createTask and in.php APIs. Change the address and you are connected.View API docs
GATESOLVER

Web scraping

curl_cffi for browser-like requests

Some sites judge a client by how it opens a TLS connection before it reads a single header. curl_cffi lets Python speak like a real browser at that level, with an API that feels like requests.

Why fingerprints matter

When a client connects over HTTPS, the first message it sends (the TLS ClientHello) lists cipher suites, extensions and their order. Browsers produce characteristic patterns, and so do HTTP libraries. Bot management systems hash that pattern, commonly as a JA3 or similar fingerprint, and compare it with the User-Agent header. A request that claims to be Chrome in its headers but opens TLS like Python's ssl module is easy to flag. HTTP/2 adds another layer: the order of settings and pseudo headers also differs between clients, as described under HTTP/2 fingerprinting.

curl_cffi is a Python binding to a patched build of curl that can reproduce browser TLS and HTTP/2 fingerprints. You choose a browser profile with one argument, and the connection, plus default headers, matches that browser.

Install and first request

pip install curl_cffi

The package ships prebuilt wheels for common platforms, so no compiler is needed in most cases. Its requests module mirrors the familiar requests API:

from curl_cffi import requests as cr

first = cr.get("https://tls.example.net/inspect", impersonate="chrome", timeout=20)
print(first.status_code, first.headers.get("content-type"))
print(first.text[:200])

The impersonate argument selects the profile. Recent versions accept a plain family name such as "chrome" or "safari" for the newest profile they ship, and versioned names such as "chrome120" or "safari17_0" to pin one. The available names depend on the installed version, so check the project's documentation for your release rather than copying a list.

Sessions keep cookies and connections

As with requests, a session reuses connections and stores cookies, which matters for sites that set a cookie on the first visit and check it later. Set the profile once on the session.

from curl_cffi import requests as cr

browser_like = cr.Session(impersonate="chrome")
try:
    browser_like.get("https://shop.example.net/", timeout=20)
    listing = browser_like.get("https://shop.example.net/category/lamps?page=2", timeout=20)
    print(listing.status_code, len(browser_like.cookies))
finally:
    browser_like.close()

Cookies set by the first response are sent with the second, just as a browser would. Keep one session per logical visitor; mixing many unrelated crawls in one session produces a cookie history no real browser would have.

Do not fight the profile's headers

Each profile sends the headers its browser would send, in that browser's order. The most common mistake is overriding them with values that contradict the fingerprint, for example a Firefox User-Agent on a Chrome profile, or a long list of headers copied from an old script. Add only what a page truly needs, such as a Referer or an Accept-Language matching your target market, and leave the rest to the profile. A request whose TLS says Chrome and whose User-Agent says Firefox is more suspicious than either alone; our mismatched User-Agent entry explains why.

Async requests

For many URLs, the async session lets one event loop keep several transfers in flight. Limit concurrency with a semaphore so you stay polite.

import asyncio
from curl_cffi.requests import AsyncSession

async def fetch_all(urls, limit=5):
    gate = asyncio.Semaphore(limit)
    async with AsyncSession(impersonate="safari") as client:
        async def one(u):
            async with gate:
                r = await client.get(u, timeout=25)
                return u, r.status_code, len(r.content)
        return await asyncio.gather(*(one(u) for u in urls))

pages = [f"https://shop.example.net/category/lamps?page={n}" for n in range(1, 9)]
for url, code, size in asyncio.run(fetch_all(pages)):
    print(code, size, url)

Proxies

Pass proxies the same way as in requests, with a dictionary keyed by scheme. Recent versions also accept a single proxy argument; use whichever your installed version documents.

exit_node = "http://user:pass@198.51.100.20:8000"
r = cr.get("https://shop.example.net/", impersonate="chrome",
           proxies={"http": exit_node, "https": exit_node}, timeout=30)

A good fingerprint does not rescue a poor IP. If a site distrusts the address, it will still challenge you; see residential or datacenter proxies for how IP type affects checks.

Choosing a profile for a whole project

Pick one browser family per project and stay with it. Consistency matters more than which browser you choose: a site that sees the same Chrome fingerprint with the same headers on every visit has little reason to treat it differently from a person on Chrome. Update the profile when you upgrade curl_cffi, so your fingerprint ages along with real browsers instead of standing out as an old version.

What curl_cffi does not do

curl_cffi makes the network layer look like a browser. It does not run JavaScript, keep a DOM, or produce browser behavior such as mouse movement. Sites that require a JavaScript check to pass, or that render data in the page, still need a real browser or the JSON endpoint the page uses. And when a site decides to show a CAPTCHA, a fingerprint will not make it go away; it only reduces how often that happens.

Handling a CAPTCHA when one appears

curl_cffi works well with token and cookie based CAPTCHA solving because it keeps a normal session. For a page protected by Cloudflare Turnstile in a form, solve the token through an API and post it with the form fields through the same session. For a firewall check that issues a cookie, such as AWS WAF, set the solved cookie on the session and repeat the request:

def apply_waf_cookie(sess, host, cookie_value):
    sess.cookies.set("aws-waf-token", cookie_value, domain=host)
    return sess.get(f"https://{host}/category/lamps?page=2", timeout=20)

For challenges whose cookie is tied to a browser identity, such as the Cloudflare challenge, send the solved cookie together with the User-Agent from the solution and keep the same IP. The guide on solving the Cloudflare challenge in Python walks through that case.

Troubleshooting

  • Unknown impersonate target: the profile name is not in your installed version. Upgrade, or pick a name from its list.
  • Still blocked with a good profile: check headers you added, the IP's reputation, and request pacing. Fingerprints are one signal among several.
  • Different results from a browser: the page may build content with JavaScript. Compare the raw HTML with what DevTools shows.
  • SSL errors behind a corporate proxy: the proxy intercepts TLS, which replaces your fingerprint with its own; test from a direct connection.
Browser-like requests are for reading public pages efficiently, not for hiding abusive traffic. Pace requests as a person would and stop when a site makes clear it does not want automated access.

Common questions

Is curl_cffi a drop in replacement for requests?

Mostly. Its requests module offers get, post, Session and similar response objects, plus the impersonate argument. Some advanced requests features differ, so test your code.

Which impersonate value should I use?

Start with a current family name such as chrome. Pin a versioned name only if you need repeatable behavior, and check which names your installed version supports.

Does curl_cffi run JavaScript?

No. It reproduces the browser's network fingerprint only. Use a real browser or the page's JSON endpoint for JavaScript rendered data.

Should I set my own User-Agent with curl_cffi?

Usually not. The profile already sends a matching User-Agent, and overriding it with a different browser creates a mismatch.

Does a browser fingerprint stop CAPTCHAs completely?

No. It removes one common reason for challenges. IP reputation, pacing and behavior still matter, and a solving API handles the challenges that remain.

Keep reading