lexiforest / curl_cffi

Python binding for curl-impersonate fork via cffi. A http client that can impersonate browser tls/ja3/http2 fingerprints.
https://curl-cffi.readthedocs.io/
MIT License
2.49k stars 265 forks source link

[BUG] Can't impersonate browsers in flatpak #362

Open FrancescoCaracciolo opened 3 months ago

FrancescoCaracciolo commented 3 months ago

Describe the bug With curl_cffi 0.7.1, when I try to impersonate a browser, it gives this error: (happens with every browser)

  File "/app/lib/python3.11/site-packages/curl_cffi/requests/session.py", line 581, in _set_curl_options
    raise RequestsError(f"Impersonating {impersonate} is not supported")
curl_cffi.requests.errors.RequestsError: Impersonating BrowserType.chrome124 is not supported

Note: this does not happen when I run curl_cffi on my system normally.

To Reproduce Within the flatpak in Newelle source code, just running

from curl_cffi import requests

r = requests.get("https://tools.scrapfly.io/api/fp/ja3", impersonate="chrome124")

or with any other browser, it gives the error Expected behavior It just works

Versions

perklet commented 3 months ago

Weird, can you somehow unpack the bundle and check if the files were correctly included?

FrancescoCaracciolo commented 3 months ago

For what file should I look for? impresonate.py is there and is correct

perklet commented 3 months ago

Does it work without the impersonate parameter?

FrancescoCaracciolo commented 3 months ago

Yes

perklet commented 3 months ago

That's even more weird, do you have any additional information?

FrancescoCaracciolo commented 3 months ago

I don't know what could be the issue either. It is possible that it is related to sandboxing?