Core API
This section documents the Scrapy core API, and it’s intended for developers of extensions and middlewares.
Crawler API
The main entry point to the Scrapy API is the Crawler
object, which components can get for
initialization. It provides access to all Scrapy core
components, and it is the only way for components to access them and hook their
functionality into Scrapy.
The Extension Manager is responsible for loading and keeping track of installed
extensions, and it’s configured through the EXTENSIONS setting,
which contains a dictionary of all available extensions and their order similar
to how you configure the downloader middlewares.
Settings API
- scrapy.settings.SETTINGS_PRIORITIES
Dictionary that sets the key name and priority level of the default settings priorities used in Scrapy.
Each item defines a settings entry point, giving it a code name for identification and an integer priority. Greater priorities take more precedence over lesser ones when setting and retrieving values in the
Settingsclass.SETTINGS_PRIORITIES = { "default": 0, "command": 10, "addon": 15, "project": 20, "spider": 30, "cmdline": 40, }
For a detailed explanation on each settings sources, see: Settings.
SpiderLoader API
Custom spider loaders can be employed by specifying their path in the
SPIDER_LOADER_CLASS project setting. They must implement
SpiderLoaderProtocol.
Signals API
Stats Collector API
There are several Stats Collectors available under the
scrapy.statscollectors module and they all implement the Stats
Collector API defined by the StatsCollector
class (which they all inherit from).