I'm using https://requests-cache.readthedocs.io/en/latest/index.html and I want to know when the cache is hit vs. the web.
According to the source code, there should be a .from_cache
flag set on the response object:
In [1]: import requests
In [2]: import requests_cache
In [3]: requests_cache.install_cache('demo_cache')
In [4]: requests.get("https://stackoverflow.com").from_cache
Out[4]: False
In [5]: requests.get("https://stackoverflow.com").from_cache
Out[5]: True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With