scrapy/docs/ref/extension-manager.rst

2.1 KiB

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> </head>

Extension Manager

System Message: ERROR/3 (<stdin>, line 7)

Unknown directive type "module".

.. module:: scrapy.extension
   :synopsis: The extension manager

The Extension Manager is responsible for loading and keeping track of installed extensions and it's configured through the :setting:`EXTENSIONS` setting which contains a list of all available extensions.

System Message: ERROR/3 (<stdin>, line 10); backlink

Unknown interpreted text role "setting".

The extension manager is a singleton-type class, which is instantiated at module load time and can be accessed like this:

from scrapy.extension import extensions
webconsole_extension = extensions.enabled['WebConsole']

Attributes

System Message: ERROR/3 (<stdin>, line 25)

Unknown directive type "attribute".

.. attribute:: ExtensionManager.loaded

    A boolean which is True if extensions are already loaded or False if
    they're not.

System Message: ERROR/3 (<stdin>, line 30)

Unknown directive type "attribute".

.. attribute:: ExtensionManager.enabled

    A dict with the enabled extensions. The keys are the extension class names,
    and the values are the extension objects. Example::

        >>> from scrapy.extension import extensions
        >>> extensions.load()
        >>> print extensions.enabled
        {'CoreStats': <scrapy.stats.corestats.CoreStats object at 0x9e272ac>,
         'WebConsoke': <scrapy.management.telnet.TelnetConsole instance at 0xa05670c>,
        ...

System Message: ERROR/3 (<stdin>, line 42)

Unknown directive type "attribute".

.. attribute:: ExtensionManager.disabled

    A dict with the disabled extensions. The keys are the extension class names,
    and the values are the extension class paths (because objects are never
    instantiated for disabled extensions). Example::

        >>> from scrapy.extension import extensions
        >>> extensions.load()
        >>> print extensions.disabled
        {'MemoryDebugger': 'scrapy.contrib.webconsole.stats.MemoryDebugger',
         'SpiderProfiler': 'scrapy.contrib.spider.profiler.SpiderProfiler',
        ...

Methods

System Message: ERROR/3 (<stdin>, line 58)

Unknown directive type "method".

.. method:: ExtensionManager.load()

    Load the available extensions configured in the :setting:`EXTENSIONS`
    setting. On a standard run, this method is usually called by the Execution
    Manager, but you may need to call it explicitly if you're dealing with
    code outside Scrapy.

System Message: ERROR/3 (<stdin>, line 65)

Unknown directive type "method".

.. method:: ExtensionManager.reload()

    Reload the available extensions. See ``load()``.
</html>