gpt4 book ai didi

python - python Mechanize 缓存功能是否与普通浏览器缓存功能相同?

转载 作者:太空宇宙 更新时间:2023-11-04 06:31:21 25 4
gpt4 key购买 nike

在其文档中,它说“可以通过使用 Mechanize.OpenerDirector 来避免这种缓存行为”。此缓存是否影响同一页面的下一个请求?

最佳答案

在我看来,文档中提到的“缓存”是指可搜索的响应,而不是类似浏览器的缓存功能。例如:

total_nr_bytes = len(response.get_data())
assert len(response.read()) == total_nr_bytes
assert len(response.read()) == 0 # we've already read the data
response.seek(0)
assert len(response.read()) == total_nr_bytes

它会在您调用 python 对象中的 .read() 后缓存数据,如果您再次请求页面,不会缓存页面本身。

简答:不会,不会影响同一页面的下一次请求

关于python - python Mechanize 缓存功能是否与普通浏览器缓存功能相同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2295812/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com