Closed mavic111 closed 1 year ago
╰─>$ cat test.py
from curl_cffi import requests
client = requests.Session(impersonate="chrome110")
res = client.get('https://google.com')
print("Google", res.status_code)
res = client.get('https://shopee.co.id')
print("Shopee", res.status_code)
╰─>$ python test.py
Google 200
Shopee 200
Sorry, I can not reproduce this. Network problems are not always reproducible, especially http2 related ones.
This should be resolved if you force libcurl
to use http1.1 only. Unfortunately, I did not expose the interface for setting this option easily, which should be fixed in the next minor version. For now, you can add one line here to use http1.1 explicitly.
CURL_HTTP_VERSION_1_1 = 2
c.setopt(CurlOpt.HTTP_VERSION, CURL_HTTP_VERSION_1_1)
it works, thanks.
For v0.5.8 above, use this:
from curl_cffi import requests, CurlHttpVersion
requests.get("https://example.com", http_version=CurlHttpVersion.V1_1)
To reproduce error: