Exceptions
Built-in Exceptions reference
Here’s a list of all exceptions included in Scrapy and their usage.
DropItem
- exception
scrapy.exceptions.
DropItem
[source]
The exception that must be raised by item pipeline stages to stop processing anItem. For more information see Item Pipeline.
CloseSpider
- exception
scrapy.exceptions.
CloseSpider
(reason='cancelled')[source] - This exception can be raised from a spider callback to request the spider to beclosed/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')
DontCloseSpider
- exception
scrapy.exceptions.
DontCloseSpider
[source]
This exception can be raised in a spider_idle
signal handler toprevent the spider from being closed.
IgnoreRequest
- exception
scrapy.exceptions.
IgnoreRequest
[source]
This exception can be raised by the Scheduler or any downloader middleware toindicate that the request should be ignored.
NotConfigured
- exception
scrapy.exceptions.
NotConfigured
[source]
This exception can be raised by some components to indicate that they willremain disabled. Those components include:
- Extensions
- Item pipelines
- Downloader middlewares
- Spider middlewares
The exception must be raised in the component’s init
method.
NotSupported
- exception
scrapy.exceptions.
NotSupported
[source]
This exception is raised to indicate an unsupported feature.