Skip to content

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

[docs] update redirect links python2 -> python3

Adityaca08e04198b9
diff --git a/docs/topics/downloader-middleware.rst b/docs/topics/downloader-middleware.rst
index 73648994d..61a3806fb 100644
--- a/docs/topics/downloader-middleware.rst
+++ b/docs/topics/downloader-middleware.rst
@@ -739,7 +739,7 @@ HttpProxyMiddleware
This middleware sets the HTTP proxy to use for requests, by setting the
``proxy`` meta value for :class:`~scrapy.http.Request` objects.
- Like the Python standard library modules `urllib`_ and `urllib2`_, it obeys
+ Like the Python standard library module `urllib.request`_, it obeys
the following environment variables:
* ``http_proxy``
@@ -751,8 +751,7 @@ HttpProxyMiddleware
Keep in mind this value will take precedence over ``http_proxy``/``https_proxy``
environment variables, and it will also ignore ``no_proxy`` environment variable.
-.. _urllib: https://docs.python.org/2/library/urllib.html
-.. _urllib2: https://docs.python.org/2/library/urllib2.html
+.. _urllib.request: https://docs.python.org/3/library/urllib.request.html
RedirectMiddleware
------------------
diff --git a/docs/topics/email.rst b/docs/topics/email.rst
index 72bf52227..aed3deb2e 100644
--- a/docs/topics/email.rst
+++ b/docs/topics/email.rst
@@ -15,7 +15,7 @@ IO of the crawler. It also provides a simple API for sending attachments and
it's very easy to configure, with a few :ref:`settings
<topics-email-settings>`.
-.. _smtplib: https://docs.python.org/2/library/smtplib.html
+.. _smtplib: https://docs.python.org/3/library/smtplib.html
Quick example
=============
diff --git a/docs/topics/exporters.rst b/docs/topics/exporters.rst
index e52682690..4ba8714bd 100644
--- a/docs/topics/exporters.rst
+++ b/docs/topics/exporters.rst
@@ -320,7 +320,7 @@ CsvItemExporter
Color TV,1200
DVD player,200
-.. _csv.writer: https://docs.python.org/2/library/csv.html#csv.writer
+.. _csv.writer: https://docs.python.org/3/library/csv.html#csv.writer
PickleItemExporter
------------------
@@ -342,7 +342,7 @@ PickleItemExporter
Pickle isn't a human readable format, so no output examples are provided.
-.. _pickle module documentation: https://docs.python.org/2/library/pickle.html
+.. _pickle module documentation: https://docs.python.org/3/library/pickle.html
PprintItemExporter
------------------
@@ -393,7 +393,7 @@ JsonItemExporter
stream-friendly format, consider using :class:`JsonLinesItemExporter`
instead, or splitting the output in multiple chunks.
-.. _JSONEncoder: https://docs.python.org/2/library/json.html#json.JSONEncoder
+.. _JSONEncoder: https://docs.python.org/3/library/json.html#json.JSONEncoder
JsonLinesItemExporter
---------------------
@@ -417,7 +417,7 @@ JsonLinesItemExporter
Unlike the one produced by :class:`JsonItemExporter`, the format produced by
this exporter is well suited for serializing large amounts of data.
-.. _JSONEncoder: https://docs.python.org/2/library/json.html#json.JSONEncoder
+.. _JSONEncoder: https://docs.python.org/3/library/json.html#json.JSONEncoder
MarshalItemExporter
-------------------
diff --git a/docs/topics/extensions.rst b/docs/topics/extensions.rst
index 94fd2e36e..f57e37e6f 100644
--- a/docs/topics/extensions.rst
+++ b/docs/topics/extensions.rst
@@ -372,5 +372,5 @@ For more info see `Debugging in Python`_.
This extension only works on POSIX-compliant platforms (i.e. not Windows).
-.. _Python debugger: https://docs.python.org/2/library/pdb.html
+.. _Python debugger: https://docs.python.org/3/library/pdb.html
.. _Debugging in Python: https://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/
diff --git a/docs/topics/items.rst b/docs/topics/items.rst
index 44643cb67..36731571e 100644
--- a/docs/topics/items.rst
+++ b/docs/topics/items.rst
@@ -24,7 +24,7 @@ serialization can be customized using Item fields metadata, :mod:`trackref`
tracks Item instances to help find memory leaks
(see :ref:`topics-leaks-trackrefs`), etc.
-.. _dictionary-like: https://docs.python.org/2/library/stdtypes.html#dict
+.. _dictionary-like: https://docs.python.org/3/library/stdtypes.html#dict
.. _topics-items-declaring:
@@ -249,7 +249,7 @@ Item objects
:class:`Field` objects used in the :ref:`Item declaration
<topics-items-declaring>`.
-.. _dict API: https://docs.python.org/2/library/stdtypes.html#dict
+.. _dict API: https://docs.python.org/3/library/stdtypes.html#dict
Field objects
=============
@@ -262,7 +262,7 @@ Field objects
to support the :ref:`item declaration syntax <topics-items-declaring>`
based on class attributes.
-.. _dict: https://docs.python.org/2/library/stdtypes.html#dict
+.. _dict: https://docs.python.org/3/library/stdtypes.html#dict
Other classes related to Item
diff --git a/docs/topics/logging.rst b/docs/topics/logging.rst
index d4d22d889..a85e1a769 100644
--- a/docs/topics/logging.rst
+++ b/docs/topics/logging.rst
@@ -83,10 +83,10 @@ path::
.. seealso::
- Module logging, `HowTo <https://docs.python.org/2/howto/logging.html>`_
+ Module logging, `HowTo <https://docs.python.org/3/howto/logging.html>`_
Basic Logging Tutorial
- Module logging, `Loggers <https://docs.python.org/2/library/logging.html#logger-objects>`_
+ Module logging, `Loggers <https://docs.python.org/3/library/logging.html#logger-objects>`_
Further documentation on loggers
.. _topics-logging-from-spiders:
@@ -166,13 +166,13 @@ possible levels listed in :ref:`topics-logging-levels`.
:setting:`LOG_FORMAT` and :setting:`LOG_DATEFORMAT` specify formatting strings
used as layouts for all messages. Those strings can contain any placeholders
listed in `logging's logrecord attributes docs
-<https://docs.python.org/2/library/logging.html#logrecord-attributes>`_ and
+<https://docs.python.org/3/library/logging.html#logrecord-attributes>`_ and
`datetime's strftime and strptime directives
-<https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior>`_
+<https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior>`_
respectively.
If :setting:`LOG_SHORT_NAMES` is set, then the logs will not display the Scrapy
-component that prints the log. It is unset by default, hence logs contain the
+component that prints the log. It is unset by default, hence logs contain the
Scrapy component responsible for that log output.
Command-line options
@@ -190,7 +190,7 @@ to override some of the Scrapy settings regarding logging.
.. seealso::
- Module `logging.handlers <https://docs.python.org/2/library/logging.handlers.html>`_
+ Module `logging.handlers <https://docs.python.org/3/library/logging.handlers.html>`_
Further documentation on available handlers
.. _custom-log-formats:
@@ -201,7 +201,7 @@ Custom Log Formats
A custom log format can be set for different actions by extending
:class:`~scrapy.logformatter.LogFormatter` class and making
:setting:`LOG_FORMATTER` point to your new class.
-
+
.. autoclass:: scrapy.logformatter.LogFormatter
:members:
@@ -276,6 +276,6 @@ scrapy.utils.log module
Refer to :ref:`run-from-script` for more details about using Scrapy this
way.
-.. _logging.basicConfig(): https://docs.python.org/2/library/logging.html#logging.basicConfig
+.. _logging.basicConfig(): https://docs.python.org/3/library/logging.html#logging.basicConfig
diff --git a/docs/topics/request-response.rst b/docs/topics/request-response.rst
index b2a60ff39..6c5a08409 100644
--- a/docs/topics/request-response.rst
+++ b/docs/topics/request-response.rst
@@ -189,7 +189,7 @@ Request objects
``copy()`` or ``replace()`` methods, and can also be accessed, in your
spider, from the ``response.cb_kwargs`` attribute.
- .. _shallow copied: https://docs.python.org/2/library/copy.html
+ .. _shallow copied: https://docs.python.org/3/library/copy.html
.. method:: Request.copy()
@@ -706,7 +706,7 @@ Response objects
A :class:`twisted.internet.ssl.Certificate` object representing
the server's SSL certificate.
-
+
Only populated for ``https`` responses, ``None`` otherwise.
.. method:: Response.copy()
@@ -724,17 +724,17 @@ Response objects
Constructs an absolute url by combining the Response's :attr:`url` with
a possible relative url.
- This is a wrapper over `urlparse.urljoin`_, it's merely an alias for
+ This is a wrapper over `urllib.parse.urljoin`_, it's merely an alias for
making this call::
- urlparse.urljoin(response.url, url)
+ urllib.parse.urljoin(response.url, url)
.. automethod:: Response.follow
.. automethod:: Response.follow_all
-.. _urlparse.urljoin: https://docs.python.org/2/library/urlparse.html#urlparse.urljoin
+.. _urllib.parse.urljoin: https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urljoin
.. _topics-request-response-ref-response-subclasses:
diff --git a/docs/topics/selectors.rst b/docs/topics/selectors.rst
index 1f7802c98..0f90b28c0 100644
--- a/docs/topics/selectors.rst
+++ b/docs/topics/selectors.rst
@@ -36,7 +36,7 @@ defines selectors to associate those styles with specific HTML elements.
.. _BeautifulSoup: https://www.crummy.com/software/BeautifulSoup/
.. _lxml: https://lxml.de/
-.. _ElementTree: https://docs.python.org/2/library/xml.etree.elementtree.html
+.. _ElementTree: https://docs.python.org/3/library/xml.etree.elementtree.html
.. _XPath: https://www.w3.org/TR/xpath/all/
.. _CSS: https://www.w3.org/TR/selectors
.. _parsel: https://parsel.readthedocs.io/en/latest/
diff --git a/docs/topics/settings.rst b/docs/topics/settings.rst
index dc6843d75..d78a6253e 100644
--- a/docs/topics/settings.rst
+++ b/docs/topics/settings.rst
@@ -28,7 +28,7 @@ The value of ``SCRAPY_SETTINGS_MODULE`` should be in Python path syntax, e.g.
``myproject.settings``. Note that the settings module should be on the
Python `import search path`_.
-.. _import search path: https://docs.python.org/2/tutorial/modules.html#the-module-search-path
+.. _import search path: https://docs.python.org/3/tutorial/modules.html#the-module-search-path
.. _populating-settings:
@@ -902,7 +902,7 @@ Default: ``'%(asctime)s [%(name)s] %(levelname)s: %(message)s'``
String for formatting log messages. Refer to the `Python logging documentation`_ for the whole list of available
placeholders.
-.. _Python logging documentation: https://docs.python.org/2/library/logging.html#logrecord-attributes
+.. _Python logging documentation: https://docs.python.org/3/library/logging.html#logrecord-attributes
.. setting:: LOG_DATEFORMAT
@@ -915,7 +915,7 @@ String for formatting date/time, expansion of the ``%(asctime)s`` placeholder
in :setting:`LOG_FORMAT`. Refer to the `Python datetime documentation`_ for the whole list of available
directives.
-.. _Python datetime documentation: https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior
+.. _Python datetime documentation: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior
.. setting:: LOG_FORMATTER
diff --git a/docs/topics/spider-middleware.rst b/docs/topics/spider-middleware.rst
index 0e8210130..3d7450c86 100644
--- a/docs/topics/spider-middleware.rst
+++ b/docs/topics/spider-middleware.rst
@@ -173,18 +173,18 @@ object gives you access, for example, to the :ref:`settings <topics-settings>`.
:type spider: :class:`~scrapy.spiders.Spider` object
.. method:: from_crawler(cls, crawler)
-
+
If present, this classmethod is called to create a middleware instance
from a :class:`~scrapy.crawler.Crawler`. It must return a new instance
of the middleware. Crawler object provides access to all Scrapy core
components like settings and signals; it is a way for middleware to
access them and hook its functionality into Scrapy.
-
+
:param crawler: crawler that uses this middleware
:type crawler: :class:`~scrapy.crawler.Crawler` object
-.. _Exception: https://docs.python.org/2/library/exceptions.html#exceptions.Exception
+.. _Exception: https://docs.python.org/3/library/exceptions.html#Exception
.. _topics-spider-middleware-ref: