Demo chat
← All resources

GUIDE / BROWSER AUTOMATION

curl_cffi.

A practical guide to curl_cffi for testing browser-like HTTP requests, sessions, and protocol compatibility in Python.

Maintained in JetskibayPublic information
GitHub repository card describing a Python HTTP client with browser fingerprint support.
Overview

curl_cffi

curl_cffi is a Python HTTP client built on a fork of curl-impersonate. It can send requests using browser-like TLS and HTTP/2 fingerprints while offering an API familiar to users of Python's requests library. The project README also documents synchronous and asynchronous requests, sessions, proxies, HTTP/3, WebSockets, and a command-line interface. It fits developers who need to inspect HTTP behavior or test a service they operate across different client profiles.

Install it with pip install curl_cffi --upgrade, then try a small request to a test endpoint: curl_cffi.get("https://tls.browserleaks.com/json", impersonate="chrome"). The quick start explains that the unnumbered chrome target follows the latest browser profile supplied by the package, while a numbered target pins a profile. For a sequence of calls, use Session to retain cookies and reuse connections. AsyncSession supports concurrent requests. Start against an endpoint you own or have permission to test, and compare status, headers, cookies, and server logs with a conventional client.

Fingerprint matching is only one part of client behavior. The impersonation FAQ says curl_cffi has no browser or JavaScript runtime, so it cannot reproduce JavaScript fingerprints or execute page interactions. The general FAQ notes that a matching TLS or HTTP/2 profile does not guarantee acceptance by a protected site; other signals can matter. Treat a successful request as evidence about that particular endpoint and configuration, not a universal browser-equivalence result. Check the target's access rules and data-use terms before requesting third-party content.

The quick start also flags differences from requests, including its multipart API for file uploads. If migrating an existing script, validate its upload, redirect, cookie, timeout, and error-handling paths rather than assuming full compatibility.

Example use cases

  • Suggested application: Compare how an API you maintain responds to a standard Python client and a browser-profile request, then inspect the negotiated protocol and server logs.
  • Suggested application: Reproduce an authorized session bug by retaining cookies across a login flow in a controlled test environment.
  • Suggested application: Add a small regression check for HTTP/2 or HTTP/3 behavior on a staging endpoint, using a pinned profile so results stay comparable.

Sources

Source image: GitHub repository sharing image for lexiforest/curl_cffi.

Maintained by Jetskibay. Reviewed 2026-09-29T00:00:00Z.

if you liked this…

Follow the trail.

  1. Read nextCloakBrowserA guide to using CloakBrowser's Playwright-compatible Chromium wrapper for authorized browser automation and testing.
  2. Use nextwappCreate on-demand WhatsApp assistants, share pairing codes, and manage their activity through MCP.
  3. See nextSlidesA presentation workspace that brings your slide brief and visual editor together.