我怎么能直接从scrapy访问httpcache中间件?
伪代码中的类似内容
URL = 'http://scrapedsite.com/category1/item1'
print retrieveRawHtml(URL)
我怎么能直接从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)
如果打开缓存,它将从缓存中提取。