有没有一种方法可以记录python时的日志;“请求缓存”;进入缓存?

有没有一种方法可以记录python时的日志;“请求缓存”;进入缓存?,python,python-requests,Python,Python Requests,我正在使用,我想知道缓存何时被命中,而不是网络 根据源代码,响应对象上应该有一个集合: 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("

我正在使用,我想知道缓存何时被命中,而不是网络

根据源代码,响应对象上应该有一个集合:

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