我试图使用以下函数来等待搜寻器完成并返回所有结果。但是,在搜寻器仍在运行时,此函数始终在被调用时立即返回。我在这里想念什么? join()不应该等待吗?
def spider_results():
runner = CrawlerRunner(get_project_settings())
results = []
def crawler_results(signal, sender, item, response, spider):
results.append(item)
dispatcher.connect(crawler_results, signal=signals.item_passed)
runner.crawl(QuotesSpider)
runner.join()
return results