lexiforest / curl_cffi

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

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

Open FrancescoCaracciolo opened 1 month ago

FrancescoCaracciolo commented 1 month 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 1 month ago

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

FrancescoCaracciolo commented 1 month ago

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

perklet commented 1 month ago

Does it work without the impersonate parameter?

FrancescoCaracciolo commented 1 month ago

Yes

perklet commented 1 month ago

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

FrancescoCaracciolo commented 1 month ago

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