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.37k stars 255 forks source link

Add support for response.history #82

Open HeartToSunshine opened 1 year ago

HeartToSunshine commented 1 year ago

CurlInfo.REDIRECT_COUNT>0时CurlInfo.REDIRECT_URL)=“”是什么原因呢?或者说作者是否能考虑一下实现一下requests下response.history的功能

perklet commented 1 year ago

如果你用底层的 curl-API 的话,怎么重定向,读取 Location header 返回的 URL 都是可以自己实现的。requests-API 中支持 history 在考虑,有空了会弄下。

cod888 commented 9 months ago

+1 for this feature

perklet commented 9 months ago

Sorry, there is no direct way to extract the redirect history of a curl request, if you let curl follow redirects automatically, and that's why this issue has been kept open for so long. You can, however, view the history via debug=True in the debug info.

If you disallow curl to follow redirect automatically, it's possible to extract the next redirect from the Location header, record it, and then follow it manually. However, that might be less performant.