mirror of https://github.com/scrapy/scrapy.git
docs: update
This commit is contained in:
parent
1d862d0831
commit
96d51c3afa
|
|
@ -145,23 +145,24 @@ scrapy.Spider
|
|||
:param kwargs: keyword arguments passed to the :meth:`__init__` method
|
||||
:type kwargs: dict
|
||||
|
||||
.. method:: update_settings(cls, settings)
|
||||
.. classmethod:: update_settings(settings)
|
||||
|
||||
The ``update_settings()`` method is used to modify the spider's settings
|
||||
and can be called during initialization of a spider instance.
|
||||
|
||||
It takes a ``Settings`` object as a parameter and adds or updates the spider's
|
||||
configuration values. This method is a class method, meaning that it is
|
||||
called on the Spider class and allows all instances of the Spider to share
|
||||
the same configuration.
|
||||
It takes a :class:`~scrapy.settings.Settings` object as a parameter and
|
||||
adds or updates the spider's configuration values. This method is a class method,
|
||||
meaning that it is called on the :class:`~scrapy.Spider` class and allows all instances
|
||||
of the spider to share the same configuration.
|
||||
|
||||
To create class hierarchies for spiders, it is recommended to use the ``custom_settings``
|
||||
To create class hierarchies for spiders, it is recommended to use the :attr:`custom_settings`
|
||||
attribute instead of ``update_settings()``, as it allows for default settings to be
|
||||
defined and automatically inherited by subclasses.
|
||||
|
||||
For example, suppose a MySpider needs update FEEDS:
|
||||
For example, suppose a spider needs update :setting:`FEEDS`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import scrapy
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue