下面是 Scrapy 提供的異常及其用法。
該異常由 item pipeline 拋出,用于停止處理 item。詳細(xì)內(nèi)容請(qǐng)參考 Item Pipeline。
該異常由 spider 的回調(diào)函數(shù)(callback)拋出,來(lái)暫停/停止 spider。支持的參數(shù):
參數(shù):
樣例:
def parse_page(self, response):
if 'Bandwidth exceeded' in response.body:
raise CloseSpider('bandwidth_exceeded')
該異常由調(diào)度器(Scheduler)或其他下載中間件拋出,聲明忽略該 request。
該異常由某些組件拋出,聲明其仍然保持關(guān)閉。這些組件包括:
該異常必須由組件的構(gòu)造器(constructor)拋出。
該異常聲明一個(gè)不支持的特性。