我正在使用https://requests-cache.readthedocs.io/en/latest/index.html,我想知道缓存何时与网络相对应。
答案 0 :(得分:3)
根据源代码,响应对象应该设置.from_cache
flag:
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