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