scrapy-curl-cffi
Scrapy integration with curl_cffi (curl-impersonate).
Installation
pip install scrapy-curl-cffi
Another option, to enable Scrapy's support for modern HTTP compression protocols:
pip install scrapy-curl-cffi[compression]
Configuration
Update your Scrapy project settings as follows:
DOWNLOAD_HANDLERS = {
"http": "scrapy_curl_cffi.handlers.CurlCffiDownloadHandler",
"https": "scrapy_curl_cffi.handlers.CurlCffiDownloadHandler",
}
DOWNLOADER_MIDDLEWARES = {
"scrapy_curl_cffi.middlewares.CurlCffiMiddleware": 200,
"scrapy_curl_cffi.middlewares.DefaultHeadersMiddleware": 400,
"scrapy_curl_cffi.middlewares.UserAgentMiddleware": 500,
"scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware": None,
"scrapy.downloadermiddlewares.useragent.UserAgentMiddleware": None,
}
TWISTED_REACTOR = "twisted.internet.asyncioreactor.AsyncioSelectorReactor"
Usage
To download a scrapy.Request with curl_cffi, add the
curl_cffi_options special key to the Request.meta attribute. The value
should be a dict with any of the following options:
impersonate- which browser version to impersonateja3- ja3 string to impersonateakamai- akamai string to impersonateextra_fp- extra fingerprints options, in complement to ja3 and akamai stringsdefault_headers- whether to set default browser headers when impersonating, defaults toTrueverify- whether to verify https certs, defaults to theDOWNLOAD_VERIFY_CERTIFICATESsettinghttp_version- HTTP version to force, e.g."v1","v2"or"v3"; defaults to theCURL_CFFI_HTTP_VERSIONsetting
See the curl_cffi documentation for more info on these options.
Alternatively, you can use the curl_cffi_options spider attribute or the
CURL_CFFI_OPTIONS setting to automatically assign the curl_cffi_options meta
for all requests.
Example spider
class FingerprintsSpider(scrapy.Spider):
name = "fingerprints"
start_urls = ["https://tls.browserleaks.com/json"]
curl_cffi_options = {"impersonate": "chrome"}
def parse(self, response):
yield response.json()
curl_cffi interop
scrapy-curl-cffi strives to adhere to established Scrapy conventions, ensuring
that most Scrapy settings, spider attributes, request/response attributes and
meta keys configure the crawler's behavior in an expected manner.
All curl_cffi downloads share one curl_cffi.AsyncSession, created lazily on
the first curl_cffi download and reused for connection pooling. The following
settings configure it:
CURL_CFFI_MAX_CLIENTS- hard limit on simultaneouscurl_cfficonnections, defaults to10DOWNLOAD_VERIFY_CERTIFICATES- whether to verify https certs, as in Scrapy itselfCURL_CFFI_HTTP_VERSION- HTTP version to force, e.g."v1","v2"or"v3"; unset letscurl_cffi(and browser impersonation) pick the versionDOWNLOAD_BIND_ADDRESS- local address to bindcurl_cffidownloads to, as in Scrapy itself; thebindaddressrequest meta key overrides itDOWNLOAD_TLS_MIN_VERSION/DOWNLOAD_TLS_MAX_VERSION- TLS version limits, as in Scrapy itself
Similar projects
Metadata
Release files for scrapy-curl-cffi 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scrapy_curl_cffi-0.4.2.tar.gz | 7.0 kB | With provenance | Details for scrapy_curl_cffi-0.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrapy_curl_cffi-0.4.2-py3-none-any.whl | Python 3 | none | any | Details for scrapy_curl_cffi-0.4.2-py3-none-any.whl |
Total release size: 15.4 kB
Release files / scrapy_curl_cffi-0.4.2.tar.gz
| Download URL | scrapy_curl_cffi-0.4.2.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c62ac99c90c4fe3a18a39611ecfed0cca0dae54a33aef0cf2df6d7cbfcfcd2f
|
|
BLAKE2b-256 checksum How to use checksums |
42700ab121ba64faedfbc43c41bb5b8296ceccf4a49c3d9ecd536f8c693d5855
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logRelease files / scrapy_curl_cffi-0.4.2-py3-none-any.whl
| Download URL | scrapy_curl_cffi-0.4.2-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9682cb2ffa3712be247a113546182a6301c093567506dcbf6fcaf0d2b1120438
|
|
BLAKE2b-256 checksum How to use checksums |
2e4135c448d907cd518dd00cfb554aebcef2af5ae2614b1ded11bca4b3e01817
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logSecurity for scrapy-curl-cffi 0.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for scrapy_curl_cffi-0.4.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.