Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Remove Sphinx module synopsis attributes and make a smarter use of module/currentmodule to minimize typing (#8011)

Adrian99323bde7592
diff --git a/docs/topics/api.rst b/docs/topics/api.rst
index 2d6005068..5d78e7bd4 100644
--- a/docs/topics/api.rst
+++ b/docs/topics/api.rst
@@ -19,7 +19,6 @@ components, and it is the only way for components to access them and hook their
functionality into Scrapy.
.. module:: scrapy.crawler
- :synopsis: The Scrapy crawler
The Extension Manager is responsible for loading and keeping track of installed
extensions and it's configured through the :setting:`EXTENSIONS` setting which
@@ -138,7 +137,6 @@ Settings API
============
.. module:: scrapy.settings
- :synopsis: Settings manager
.. attribute:: SETTINGS_PRIORITIES
@@ -181,7 +179,6 @@ SpiderLoader API
================
.. module:: scrapy.spiderloader
- :synopsis: The spider loader
Custom spider loaders can be employed by specifying their path in the
:setting:`SPIDER_LOADER_CLASS` project setting. They must implement
@@ -201,7 +198,6 @@ Signals API
===========
.. automodule:: scrapy.signalmanager
- :synopsis: The signal manager
:members:
:undoc-members:
@@ -216,7 +212,6 @@ Collector API defined by the :class:`~scrapy.statscollectors.StatsCollector`
class (which they all inherit from).
.. module:: scrapy.statscollectors
- :synopsis: Stats Collectors
.. class:: StatsCollector
diff --git a/docs/topics/contracts.rst b/docs/topics/contracts.rst
index 59b8855ea..6678dcddc 100644
--- a/docs/topics/contracts.rst
+++ b/docs/topics/contracts.rst
@@ -77,9 +77,7 @@ create and load your own contracts in the project by using the
Each contract must inherit from :class:`~scrapy.contracts.Contract` and can
override three methods:
-.. module:: scrapy.contracts
-
-.. autoclass:: Contract
+.. autoclass:: scrapy.contracts.Contract
.. automethod:: adjust_request_args
diff --git a/docs/topics/cookies.rst b/docs/topics/cookies.rst
index ab5f3dca0..d7fcf6eca 100644
--- a/docs/topics/cookies.rst
+++ b/docs/topics/cookies.rst
@@ -132,7 +132,4 @@ header)::
CookiesMiddleware
=================
-.. module:: scrapy.downloadermiddlewares.cookies
- :synopsis: Cookies Downloader Middleware
-
-.. autoclass:: CookiesMiddleware
+.. autoclass:: scrapy.downloadermiddlewares.cookies.CookiesMiddleware
diff --git a/docs/topics/downloader-middleware.rst b/docs/topics/downloader-middleware.rst
index ae35d5e9b..8fcad6239 100644
--- a/docs/topics/downloader-middleware.rst
+++ b/docs/topics/downloader-middleware.rst
@@ -1,3 +1,5 @@
+.. module:: scrapy.downloadermiddlewares
+
.. _topics-downloader-middleware:
=====================
@@ -30,11 +32,11 @@ The :setting:`DOWNLOADER_MIDDLEWARES` setting is merged with the
:setting:`DOWNLOADER_MIDDLEWARES_BASE` setting defined in Scrapy (and not meant
to be overridden) and then sorted by order to get the final sorted list of
enabled middlewares: the first middleware is the one closer to the engine and
-the last is the one closer to the downloader. In other words,
-the :meth:`~scrapy.downloadermiddlewares.DownloaderMiddleware.process_request`
-method of each middleware will be invoked in increasing
-middleware order (100, 200, 300, ...) and the :meth:`~scrapy.downloadermiddlewares.DownloaderMiddleware.process_response` method
-of each middleware will be invoked in decreasing order.
+the last is the one closer to the downloader. In other words, the
+:meth:`~DownloaderMiddleware.process_request` method of each middleware will be
+invoked in increasing middleware order (100, 200, 300, ...) and the
+:meth:`~DownloaderMiddleware.process_response` method of each middleware will
+be invoked in decreasing order.
To decide which order to assign to your middleware see the
:setting:`DOWNLOADER_MIDDLEWARES_BASE` setting and pick a value according to
@@ -65,8 +67,6 @@ Writing your own downloader middleware
Each downloader middleware is a :ref:`component <topics-components>` that
defines one or more of these methods:
-.. module:: scrapy.downloadermiddlewares
-
.. class:: DownloaderMiddleware
.. note:: Any of the downloader middleware methods may be defined as a
@@ -157,6 +157,8 @@ defines one or more of these methods:
:param exception: the raised exception
:type exception: an ``Exception`` object
+.. currentmodule:: None
+
.. _mw-download:
Downloading a request from a downloader middleware
@@ -234,10 +236,7 @@ See :ref:`cookies`.
DefaultHeadersMiddleware
------------------------
-.. module:: scrapy.downloadermiddlewares.defaultheaders
- :synopsis: Default Headers Downloader Middleware
-
-.. class:: DefaultHeadersMiddleware
+.. class:: scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware
This middleware sets all default requests headers specified in the
:setting:`DEFAULT_REQUEST_HEADERS` setting.
@@ -245,10 +244,7 @@ DefaultHeadersMiddleware
DownloadTimeoutMiddleware
-------------------------
-.. module:: scrapy.downloadermiddlewares.downloadtimeout
- :synopsis: Download timeout middleware
-
-.. class:: DownloadTimeoutMiddleware
+.. class:: scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware
This middleware sets the download timeout for requests specified in the
:setting:`DOWNLOAD_TIMEOUT` setting.
@@ -262,10 +258,7 @@ DownloadTimeoutMiddleware
HttpAuthMiddleware
------------------
-.. module:: scrapy.downloadermiddlewares.httpauth
- :synopsis: HTTP Auth downloader middleware
-
-.. class:: HttpAuthMiddleware
+.. class:: scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware
This middleware authenticates requests using `Basic access authentication`_
(aka. HTTP auth).
@@ -353,10 +346,7 @@ or :setting:`HTTPAUTH_PASS` is set.
HttpCacheMiddleware
-------------------
-.. module:: scrapy.downloadermiddlewares.httpcache
- :synopsis: HTTP Cache downloader middleware
-
-.. class:: HttpCacheMiddleware
+.. class:: scrapy.downloadermiddlewares.httpcache.HttpCacheMiddleware
This middleware provides low-level cache to all HTTP requests and responses.
It has to be combined with a cache storage backend as well as a cache policy.
@@ -391,7 +381,6 @@ HttpCacheMiddleware
the page was downloaded rather than to the current time.
.. module:: scrapy.extensions.httpcache
- :noindex:
.. _httpcache-policy-dummy:
@@ -517,8 +506,6 @@ To store a response, use :meth:`Response.to_dict()
:func:`~scrapy.utils.response.response_from_dict`. That way responses of any
class, including those of third-party plugins, are cached and restored intact.
-.. module:: scrapy.extensions.httpcache
-
.. class:: CacheStorage
.. method:: open_spider(spider)
@@ -712,15 +699,14 @@ We assume that the spider will not issue Cache-Control directives
in requests unless it actually needs them, so directives in requests are
not filtered.
+.. currentmodule:: None
+
.. _http-compression:
HttpCompressionMiddleware
-------------------------
-.. module:: scrapy.downloadermiddlewares.httpcompression
- :synopsis: Http Compression Middleware
-
-.. class:: HttpCompressionMiddleware
+.. class:: scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware
This middleware allows compressed (gzip, deflate, `brotli`_, `zstd`_)
traffic to be sent/received from web sites.
@@ -745,11 +731,10 @@ Whether the Compression middleware will be enabled.
HttpProxyMiddleware
-------------------
-.. module:: scrapy.downloadermiddlewares.httpproxy
- :synopsis: Http Proxy Middleware
-
.. reqmeta:: proxy
+.. module:: scrapy.downloadermiddlewares.httpproxy
+
.. class:: HttpProxyMiddleware
This middleware sets the HTTP proxy to use for requests, by setting the
@@ -815,10 +800,7 @@ The default encoding for proxy authentication on :class:`HttpProxyMiddleware`.
OffsiteMiddleware
-----------------
-.. module:: scrapy.downloadermiddlewares.offsite
- :synopsis: Offsite Middleware
-
-.. autoclass:: OffsiteMiddleware
+.. autoclass:: scrapy.downloadermiddlewares.offsite.OffsiteMiddleware
.. automethod:: should_follow
@@ -826,7 +808,6 @@ RedirectMiddleware
------------------
.. module:: scrapy.downloadermiddlewares.redirect
- :synopsis: Redirection Middleware
.. class:: RedirectMiddleware
@@ -1006,7 +987,6 @@ RetryMiddleware
---------------
.. module:: scrapy.downloadermiddlewares.retry
- :synopsis: Retry Middleware
.. class:: RetryMiddleware
@@ -1137,15 +1117,14 @@ Adjust retry request priority relative to original request:
See also: :reqmeta:`priority_adjust`.
+.. currentmodule:: None
+
.. _topics-dlmw-robots:
RobotsTxtMiddleware
-------------------
-.. module:: scrapy.downloadermiddlewares.robotstxt
- :synopsis: robots.txt middleware
-
-.. class:: RobotsTxtMiddleware
+.. class:: scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware
This middleware filters out requests forbidden by the robots.txt exclusion
standard.
@@ -1265,10 +1244,7 @@ You can implement support for a new robots.txt_ parser by subclassing
the abstract base class :class:`~scrapy.robotstxt.RobotParser` and
implementing the methods described below.
-.. module:: scrapy.robotstxt
- :synopsis: robots.txt parser interface and implementations
-
-.. autoclass:: RobotParser
+.. autoclass:: scrapy.robotstxt.RobotParser
:members:
.. _robots.txt: https://www.robotstxt.org/
@@ -1276,10 +1252,7 @@ implementing the methods described below.
DownloaderStats
---------------
-.. module:: scrapy.downloadermiddlewares.stats
- :synopsis: Downloader Stats Middleware
-
-.. class:: DownloaderStats
+.. class:: scrapy.downloadermiddlewares.stats.DownloaderStats
Middleware that stores stats of all requests, responses and exceptions that
pass through it.
@@ -1290,10 +1263,7 @@ DownloaderStats
UserAgentMiddleware
-------------------
-.. module:: scrapy.downloadermiddlewares.useragent
- :synopsis: User Agent Middleware
-
-.. class:: UserAgentMiddleware
+.. class:: scrapy.downloadermiddlewares.useragent.UserAgentMiddleware
Middleware that sets the ``User-Agent`` header.
diff --git a/docs/topics/exporters.rst b/docs/topics/exporters.rst
index d7bc5675e..ee906d002 100644
--- a/docs/topics/exporters.rst
+++ b/docs/topics/exporters.rst
@@ -5,7 +5,6 @@ Item Exporters
==============
.. module:: scrapy.exporters
- :synopsis: Item Exporters
Once you have scraped your items, you often want to persist or export those
items, to use the data in some other application. That is, after all, the whole
diff --git a/docs/topics/extensions.rst b/docs/topics/extensions.rst
index ee3b26aa1..440377e56 100644
--- a/docs/topics/extensions.rst
+++ b/docs/topics/extensions.rst
@@ -119,20 +119,14 @@ General purpose extensions
Log Stats extension
~~~~~~~~~~~~~~~~~~~
-.. module:: scrapy.extensions.logstats
- :synopsis: Basic stats logging
-
-.. class:: LogStats
+.. class:: scrapy.extensions.logstats.LogStats
Log basic stats like crawled pages and scraped items.
Core Stats extension
~~~~~~~~~~~~~~~~~~~~
-.. module:: scrapy.extensions.corestats
- :synopsis: Core stats collection
-
-.. class:: CoreStats
+.. class:: scrapy.extensions.corestats.CoreStats
Enable the collection of core statistics, provided the stats collection is
enabled (see :ref:`topics-stats`).
@@ -145,20 +139,14 @@ The following stats are collected: :stat:`elapsed_time_seconds`,
Log Count extension
~~~~~~~~~~~~~~~~~~~
-.. module:: scrapy.extensions.logcount
- :synopsis: Basic stats logging
-
-.. autoclass:: LogCount
+.. autoclass:: scrapy.extensions.logcount.LogCount
.. _topics-extensions-ref-memusage:
Memory usage extension
~~~~~~~~~~~~~~~~~~~~~~
-.. module:: scrapy.extensions.memusage
- :synopsis: Memory usage extension
-
-.. class:: MemoryUsage
+.. class:: scrapy.extensions.memusage.MemoryUsage
.. note:: This extension does not work in Windows.
@@ -179,10 +167,7 @@ can be configured with the following settings:
Memory debugger extension
~~~~~~~~~~~~~~~~~~~~~~~~~
-.. module:: scrapy.extensions.memdebug
- :synopsis: Memory debugger extension
-
-.. class:: MemoryDebugger
+.. class:: scrapy.extensions.memdebug.MemoryDebugger
An extension for debugging memory usage. It collects information about:
@@ -198,10 +183,7 @@ info will be stored in the :stat:`memdebug/gc_garbage_count` and
Spider state extension
~~~~~~~~~~~~~~~~~~~~~~
-.. module:: scrapy.extensions.spiderstate
- :synopsis: Spider state extension
-
-.. class:: SpiderState
+.. class:: scrapy.extensions.spiderstate.SpiderState
Manages spider state data by loading it before a crawl and saving it after.
@@ -222,10 +204,7 @@ For an example, see :ref:`topics-keeping-persistent-state-between-batches`.
Close spider extension
~~~~~~~~~~~~~~~~~~~~~~
-.. module:: scrapy.extensions.closespider
- :synopsis: Close spider extension
-
-.. class:: CloseSpider
+.. class:: scrapy.extensions.closespider.CloseSpider
Closes a spider automatically when some conditions are met, using a specific
closing reason for each condition.
@@ -318,13 +297,10 @@ closing the spider. If the spider generates more than that number of errors,
it will be closed with the reason ``closespider_errorcount``. If zero (or non
set), spiders won't be closed by number of errors.
-.. module:: scrapy.extensions.periodic_log
- :synopsis: Periodic stats logging
-
Periodic log extension
~~~~~~~~~~~~~~~~~~~~~~
-.. class:: PeriodicLog
+.. class:: scrapy.extensions.periodic_log.PeriodicLog
This extension periodically logs rich stat data as a JSON object::
@@ -437,12 +413,11 @@ Default: ``False``
Debugging extensions
--------------------
-.. module:: scrapy.extensions.debug
- :synopsis: Extensions for debugging Scrapy
-
Stack trace dump extension
~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. module:: scrapy.extensions.debug
+
.. class:: StackTraceDump
Dumps information about the running process when a `SIGQUIT`_ or `SIGUSR2`_
@@ -480,15 +455,14 @@ running normally.
This extension only works on POSIX-compliant platforms (i.e. not Windows).
+.. currentmodule:: None
+
.. _topics-extensions-ref-telnetconsole:
Telnet console extension
~~~~~~~~~~~~~~~~~~~~~~~~
-.. module:: scrapy.extensions.telnet
- :synopsis: Telnet console
-
-.. class:: TelnetConsole
+.. class:: scrapy.extensions.telnet.TelnetConsole
Provides a telnet console for getting into a Python interpreter inside the
currently running Scrapy process, which can be very useful for debugging.
diff --git a/docs/topics/feed-exports.rst b/docs/topics/feed-exports.rst
index 7d8a02f8e..4ce874249 100644
--- a/docs/topics/feed-exports.rst
+++ b/docs/topics/feed-exports.rst
@@ -442,8 +442,6 @@ These are the settings used for configuring the feed exports:
- :setting:`FEED_EXPORTERS`
- :setting:`FEED_EXPORT_BATCH_ITEM_COUNT`
-.. currentmodule:: scrapy.extensions.feedexport
-
.. setting:: FEEDS
FEEDS
@@ -768,7 +766,7 @@ feed URI.
The function signature should be as follows:
-.. function:: uri_params(params, spider)
+.. function:: scrapy.extensions.feedexport.uri_params(params, spider)
Return a :class:`dict` of key-value pairs to apply to the feed URI using
:ref:`printf-style string formatting <python:old-string-formatting>`.
diff --git a/docs/topics/items.rst b/docs/topics/items.rst
index 0892dd839..1bd7fa312 100644
--- a/docs/topics/items.rst
+++ b/docs/topics/items.rst
@@ -5,7 +5,6 @@ Items
=====
.. module:: scrapy.item
- :synopsis: Item and Field classes
The main goal in scraping is to extract structured data from unstructured
sources, typically, web pages. :ref:`Spiders <topics-spiders>` may return the
diff --git a/docs/topics/leaks.rst b/docs/topics/leaks.rst
index a055ee715..ea60a14ce 100644
--- a/docs/topics/leaks.rst
+++ b/docs/topics/leaks.rst
@@ -180,7 +180,6 @@ example, this won't show any live references to spiders:
>>> prefs(ignore=Spider)
.. module:: scrapy.utils.trackref
- :synopsis: Track references of live objects
scrapy.utils.trackref module
----------------------------
diff --git a/docs/topics/link-extractors.rst b/docs/topics/link-extractors.rst
index c1d872dd0..3c0800710 100644
--- a/docs/topics/link-extractors.rst
+++ b/docs/topics/link-extractors.rst
@@ -31,9 +31,6 @@ variable in your spider, and use it from your spider callbacks:
Link extractor reference
========================
-.. module:: scrapy.linkextractors
- :synopsis: Link extractors classes
-
The link extractor class is
:class:`scrapy.linkextractors.lxmlhtml.LxmlLinkExtractor`. For convenience it
can also be imported as ``scrapy.linkextractors.LinkExtractor``:
@@ -45,18 +42,11 @@ can also be imported as ``scrapy.linkextractors.LinkExtractor``:
LxmlLinkExtractor
-----------------
-.. module:: scrapy.linkextractors.lxmlhtml
- :synopsis: lxml's HTMLParser-based link extractors
-
-
-.. autoclass:: LxmlLinkExtractor
+.. autoclass:: scrapy.linkextractors.lxmlhtml.LxmlLinkExtractor
.. automethod:: extract_links
Link
----
-.. module:: scrapy.link
- :synopsis: Link from link extractors
-
-.. autoclass:: Link
+.. autoclass:: scrapy.link.Link
diff --git a/docs/topics/loaders.rst b/docs/topics/loaders.rst
index 314e2c1ae..c6271f438 100644
--- a/docs/topics/loaders.rst
+++ b/docs/topics/loaders.rst
@@ -5,7 +5,6 @@ Item Loaders
============
.. module:: scrapy.loader
- :synopsis: Item Loader class
Item Loaders provide a convenient mechanism for populating scraped :ref:`items
<topics-items>`. Even though items can be populated directly, Item Loaders provide a
diff --git a/docs/topics/logging.rst b/docs/topics/logging.rst
index 8ac691840..8c09e15eb 100644
--- a/docs/topics/logging.rst
+++ b/docs/topics/logging.rst
@@ -367,10 +367,7 @@ and hide it without affecting other loggers:
scrapy.utils.log module
=======================
-.. module:: scrapy.utils.log
- :synopsis: Logging utils
-
-.. autofunction:: configure_logging
+.. autofunction:: scrapy.utils.log.configure_logging
``configure_logging`` is automatically called when using Scrapy commands
or :class:`~scrapy.crawler.CrawlerProcess`, but needs to be called explicitly
diff --git a/docs/topics/media-pipeline.rst b/docs/topics/media-pipeline.rst
index 43fedbadc..b9cdf64bd 100644
--- a/docs/topics/media-pipeline.rst
+++ b/docs/topics/media-pipeline.rst
@@ -567,7 +567,6 @@ Extending the Media Pipelines
=============================
.. module:: scrapy.pipelines.files
- :synopsis: Files Pipeline
See here the methods that you can override in your custom Files Pipeline:
@@ -716,7 +715,6 @@ See here the methods that you can override in your custom Files Pipeline:
.. module:: scrapy.pipelines.images
- :synopsis: Images Pipeline
See here the methods that you can override in your custom Images Pipeline:
diff --git a/docs/topics/request-response.rst b/docs/topics/request-response.rst
index d001c46b9..b587a290f 100644
--- a/docs/topics/request-response.rst
+++ b/docs/topics/request-response.rst
@@ -5,7 +5,6 @@ Requests and Responses
======================
.. module:: scrapy.http
- :synopsis: Request and Response classes
Scrapy uses :class:`~scrapy.Request` and :class:`Response` objects for crawling web
sites.
diff --git a/docs/topics/selectors.rst b/docs/topics/selectors.rst
index 6d4954c2d..dd919013d 100644
--- a/docs/topics/selectors.rst
+++ b/docs/topics/selectors.rst
@@ -1039,7 +1039,6 @@ Built-in Selectors reference
============================
.. module:: scrapy.selector
- :synopsis: Selector class
Selector objects
----------------
diff --git a/docs/topics/signals.rst b/docs/topics/signals.rst
index c73edbf05..2aa13edf6 100644
--- a/docs/topics/signals.rst
+++ b/docs/topics/signals.rst
@@ -112,7 +112,6 @@ Built-in signals reference
==========================
.. module:: scrapy.signals
- :synopsis: Signals definitions
Here's the list of Scrapy built-in signals and their meaning.
diff --git a/docs/topics/spider-middleware.rst b/docs/topics/spider-middleware.rst
index cb5608ac6..2558d4031 100644
--- a/docs/topics/spider-middleware.rst
+++ b/docs/topics/spider-middleware.rst
@@ -1,3 +1,5 @@
+.. module:: scrapy.spidermiddlewares
+
.. _topics-spider-middleware:
=================
@@ -31,12 +33,11 @@ The :setting:`SPIDER_MIDDLEWARES` setting is merged with the
:setting:`SPIDER_MIDDLEWARES_BASE` setting defined in Scrapy (and not meant to
be overridden) and then sorted by order to get the final sorted list of enabled
middlewares: the first middleware is the one closer to the engine and the last
-is the one closer to the spider. In other words,
-the :meth:`~scrapy.spidermiddlewares.SpiderMiddleware.process_spider_input`
-method of each middleware will be invoked in increasing
-middleware order (100, 200, 300, ...), and the
-:meth:`~scrapy.spidermiddlewares.SpiderMiddleware.process_spider_output` method
-of each middleware will be invoked in decreasing order.
+is the one closer to the spider. In other words, the
+:meth:`~SpiderMiddleware.process_spider_input` method of each middleware will
+be invoked in increasing middleware order (100, 200, 300, ...), and the
+:meth:`~SpiderMiddleware.process_spider_output` method of each middleware will
+be invoked in decreasing order.
To decide which order to assign to your middleware see the
:setting:`SPIDER_MIDDLEWARES_BASE` setting and pick a value according to where
@@ -67,8 +68,6 @@ Writing your own spider middleware
Each spider middleware is a :ref:`component <topics-components>` that defines
one or more of these methods:
-.. module:: scrapy.spidermiddlewares
-
.. class:: SpiderMiddleware
.. method:: process_start(start: AsyncIterator[Any], /) -> AsyncIterator[Any]
@@ -204,15 +203,15 @@ For example:
# ... do something with r
yield r
+.. currentmodule:: None
+
Base class for custom spider middlewares
----------------------------------------
Scrapy provides a base class for custom spider middlewares. It's not required
to use it but it can help with simplifying middleware implementations.
-.. module:: scrapy.spidermiddlewares.base
-
-.. autoclass:: BaseSpiderMiddleware
+.. autoclass:: scrapy.spidermiddlewares.base.BaseSpiderMiddleware
:members:
.. _topics-spider-middleware-ref:
@@ -230,20 +229,14 @@ For a list of the components enabled by default (and their orders) see the
DepthMiddleware
---------------
-.. module:: scrapy.spidermiddlewares.depth
- :synopsis: Depth Spider Middleware
-
.. reqmeta:: depth
-.. autoclass:: DepthMiddleware
+.. autoclass:: scrapy.spidermiddlewares.depth.DepthMiddleware
HttpErrorMiddleware
-------------------
-.. module:: scrapy.spidermiddlewares.httperror
- :synopsis: HTTP Error Spider Middleware
-
-.. class:: HttpErrorMiddleware
+.. class:: scrapy.spidermiddlewares.httperror.HttpErrorMiddleware
Filter out unsuccessful (erroneous) HTTP responses so that spiders don't
have to deal with them, which (most of the time) imposes an overhead,
@@ -312,10 +305,7 @@ Pass all responses, regardless of its status code.
MetaCopyDetectionMiddleware
---------------------------
-.. module:: scrapy.spidermiddlewares.metacopy
- :synopsis: Meta Copy Detection Spider Middleware
-
-.. class:: MetaCopyDetectionMiddleware
+.. class:: scrapy.spidermiddlewares.metacopy.MetaCopyDetectionMiddleware
Warns when a spider yields a request that contains internal meta keys which
should not be copied from :attr:`response.meta <scrapy.http.Response.meta>`
@@ -342,7 +332,6 @@ RefererMiddleware
-----------------
.. module:: scrapy.spidermiddlewares.referer
- :synopsis: Referer Spider Middleware
.. class:: RefererMiddleware
@@ -366,7 +355,7 @@ Whether to enable referer middleware.
REFERRER_POLICY
^^^^^^^^^^^^^^^
-Default: ``'scrapy.spidermiddlewares.referer.DefaultReferrerPolicy'``
+Default: ``"scrapy.spidermiddlewares.referer.DefaultReferrerPolicy"``
.. reqmeta:: referrer_policy
@@ -382,24 +371,24 @@ Default: ``'scrapy.spidermiddlewares.referer.DefaultReferrerPolicy'``
Acceptable values for REFERRER_POLICY
*************************************
-- either a path to a :class:`scrapy.spidermiddlewares.referer.ReferrerPolicy`
- subclass — a custom policy or one of the built-in ones (see classes below),
+- either a path to a :class:`ReferrerPolicy` subclass — a custom policy or one
+ of the built-in ones (see classes below),
- or one or more comma-separated standard W3C-defined string values,
- or the special ``"scrapy-default"``.
-======================================= ========================================================================
-String value Class name (as a string)
-======================================= ========================================================================
-``"scrapy-default"`` (default) :class:`scrapy.spidermiddlewares.referer.DefaultReferrerPolicy`
-`"no-referrer"`_ :class:`scrapy.spidermiddlewares.referer.NoReferrerPolicy`
-`"no-referrer-when-downgrade"`_ :class:`scrapy.spidermiddlewares.referer.NoReferrerWhenDowngradePolicy`
-`"same-origin"`_ :class:`scrapy.spidermiddlewares.referer.SameOriginPolicy`
-`"origin"`_ :class:`scrapy.spidermiddlewares.referer.OriginPolicy`
-`"strict-origin"`_ :class:`scrapy.spidermiddlewares.referer.StrictOriginPolicy`
-`"origin-when-cross-origin"`_ :class:`scrapy.spidermiddlewares.referer.OriginWhenCrossOriginPolicy`
-`"strict-origin-when-cross-origin"`_ :class:`scrapy.spidermiddlewares.referer.StrictOriginWhenCrossOriginPolicy`
-`"unsafe-url"`_ :class:`scrapy.spidermiddlewares.referer.UnsafeUrlPolicy`
-======================================= ========================================================================
+======================================= ==========================================
+String value Class
+======================================= ==========================================
+``"scrapy-default"`` (default) :class:`DefaultReferrerPolicy`
+`"no-referrer"`_ :class:`NoReferrerPolicy`
+`"no-referrer-when-downgrade"`_ :class:`NoReferrerWhenDowngradePolicy`
+`"same-origin"`_ :class:`SameOriginPolicy`
+`"origin"`_ :class:`OriginPolicy`
+`"strict-origin"`_ :class:`StrictOriginPolicy`
+`"origin-when-cross-origin"`_ :class:`OriginWhenCrossOriginPolicy`
+`"strict-origin-when-cross-origin"`_ :class:`StrictOriginWhenCrossOriginPolicy`
+`"unsafe-url"`_ :class:`UnsafeUrlPolicy`
+======================================= ==========================================
.. autoclass:: ReferrerPolicy
@@ -455,9 +444,8 @@ REFERRER_POLICIES
Default: ``{}``
-A dictionary mapping policy names to import paths of
-:class:`scrapy.spidermiddlewares.referer.ReferrerPolicy` subclasses, or
-``None`` to disable support for a given policy name.
+A dictionary mapping policy names to import paths of :class:`ReferrerPolicy`
+subclasses, or ``None`` to disable support for a given policy name.
This allows overriding the policies triggered by the ``Referrer-Policy``
response header.
@@ -465,26 +453,23 @@ response header.
Use ``""`` to override the policy for responses with `no referrer policy
<https://www.w3.org/TR/referrer-policy/#referrer-policy-empty-string>`__.
+.. currentmodule:: None
+
StartSpiderMiddleware
---------------------
-.. module:: scrapy.spidermiddlewares.start
-
-.. autoclass:: StartSpiderMiddleware
+.. autoclass:: scrapy.spidermiddlewares.start.StartSpiderMiddleware
UrlLengthMiddleware
-------------------
-.. module:: scrapy.spidermiddlewares.urllength
- :synopsis: URL Length Spider Middleware
-
-.. class:: UrlLengthMiddleware
+.. class:: scrapy.spidermiddlewares.urllength.UrlLengthMiddleware
Filters out requests with URLs longer than URLLENGTH_LIMIT
- The :class:`UrlLengthMiddleware` can be configured through the following
+ This middleware can be configured through the following
settings (see the settings documentation for more info):
* :setting:`URLLENGTH_LIMIT` - The maximum URL length to allow for crawled URLs.
diff --git a/docs/topics/telnetconsole.rst b/docs/topics/telnetconsole.rst
index ffba2346a..3a22a81c2 100644
--- a/docs/topics/telnetconsole.rst
+++ b/docs/topics/telnetconsole.rst
@@ -1,4 +1,4 @@
-.. currentmodule:: scrapy.extensions.telnet
+.. module:: scrapy.extensions.telnet
.. _topics-telnetconsole: