[英]Is there a way I can log when python “requests-cache” hits the cache?
According to the source code, there should be a .from_cache
flag set on the response object: 根据源代码,应在响应对象上设置一个
.from_cache
标志 :
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.