0
如何直接从scrapy访问httpcache中间件?如何直接访问Scrapy httpcache中间件数据
事情是这样的伪代码
URL = 'http://scrapedsite.com/category1/item1'
print retrieveRawHtml(URL)
如何直接从scrapy访问httpcache中间件?如何直接访问Scrapy httpcache中间件数据
事情是这样的伪代码
URL = 'http://scrapedsite.com/category1/item1'
print retrieveRawHtml(URL)
from scrapy.utils.response import open_in_browser
from scrapy.http import HtmlResponse
url = 'http://scrapedsite.com/category1/item1'
body = '<html>hello</html>'
response = HtmlResponse(url, body=body)
open_in_browser(response)
或回调:
def parse_cb(self, response):
from scrapy.utils.response import open_in_browser
open_in_browser(response)
如果缓存被打开它会从缓存中拉。
thx ..太明显了..想得太复杂了。 – Jabb 2013-03-20 00:19:56
“如果缓存打开,它将从缓存中提取。”,很有趣。你可以画一些关于如何做到这一点?谢谢。 – Medeiros 2013-09-25 20:47:58
请参阅[HTTPCACHE_ENABLED](http://doc.scrapy.org/zh/latest/topics/downloader-middleware.html#httpcache-enabled)设置 – 2013-09-26 00:31:58