Here’s a list of all exceptions included in Scrapy and their usage.
The exception that must be raised by item pipeline stages to stop processing an Item. For more information see Item Pipeline.
This exception can be raised from a spider callback to request the spider to be closed/stopped. Supported arguments:
Parameters: | reason (str) – the reason for closing |
---|
For example:
def parse_page(self, response):
if 'Bandwidth exceeded' in response.body:
raise CloseSpider('bandwidth_exceeded')
This exception can be raised by the Scheduler or any downloader middleware to indicate that the request should be ignored.
This exception can be raised by some components to indicate that they will remain disabled. Those components include:
- Extensions
- Item pipelines
- Downloader middlwares
- Spider middlewares
The exception must be raised in the component constructor.