@@ -5,7 +5,7 @@ Extensions
5
5
==========
6
6
7
7
The extensions framework provides a mechanism for inserting your own
8
- custom functionality into Scrapy.
8
+ custom functionality into Scrapy.
9
9
10
10
Extensions are just regular classes that are instantiated at Scrapy startup,
11
11
when extensions are initialized.
@@ -75,14 +75,10 @@ included in the :setting:`EXTENSIONS_BASE` setting) you must set its order to
75
75
Writing your own extension
76
76
==========================
77
77
78
- Writing your own extension is easy. Each extension is a single Python class
79
- which doesn't need to implement any particular method.
80
-
81
- The main entry point for a Scrapy extension (this also includes middlewares and
82
- pipelines) is the ``from_crawler `` class method which receives a
83
- ``Crawler `` instance which is the main object controlling the Scrapy crawler.
84
- Through that object you can access settings, signals, stats, and also control
85
- the crawler behaviour, if your extension needs to such thing.
78
+ Each extension is a Python class. The main entry point for a Scrapy extension
79
+ (this also includes middlewares and pipelines) is the ``from_crawler ``
80
+ class method which receives a ``Crawler `` instance. Through the Crawler object
81
+ you can access settings, signals, stats, and also control the crawling behaviour.
86
82
87
83
Typically, extensions connect to :ref: `signals <topics-signals >` and perform
88
84
tasks triggered by them.
@@ -133,7 +129,7 @@ Here is the code of such extension::
133
129
crawler.signals.connect(ext.spider_closed, signal=signals.spider_closed)
134
130
crawler.signals.connect(ext.item_scraped, signal=signals.item_scraped)
135
131
136
- # return the extension object
132
+ # return the extension object
137
133
return ext
138
134
139
135
def spider_opened(self, spider):
@@ -183,12 +179,12 @@ Telnet console extension
183
179
~~~~~~~~~~~~~~~~~~~~~~~~
184
180
185
181
.. module :: scrapy.telnet
186
- :synopsis: Telnet console
182
+ :synopsis: Telnet console
187
183
188
184
.. class :: scrapy.telnet.TelnetConsole
189
185
190
186
Provides a telnet console for getting into a Python interpreter inside the
191
- currently running Scrapy process, which can be very useful for debugging.
187
+ currently running Scrapy process, which can be very useful for debugging.
192
188
193
189
The telnet console must be enabled by the :setting: `TELNETCONSOLE_ENABLED `
194
190
setting, and the server will listen in the port specified in
0 commit comments