Skip to content

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

merged with Daniel's HttpException-removal branch

Pablo Hoffman04e7f8f5f62d
diff --cc docs/ref/downloader-middleware.rst
index 42fb23d92,ed9d017f7..976e32c04
--- a/docs/ref/downloader-middleware.rst
+++ b/docs/ref/downloader-middleware.rst
@@@ -4,11 -4,11 +4,14 @@@
Built-in downloader middleware reference
========================================
--This document explains all downloader middleware components that come with
++This page describes all downloader middleware components that come with
Scrapy. For information on how to use them and how to write your own downloader
middleware, see the :ref:`downloader middleware usage guide
<topics-downloader-middleware>`.
++For a list of the components enabled by default (and their orders) see the
++:setting:`DOWNLOADER_MIDDLEWARES_BASE` setting.
++
Available downloader middlewares
================================
diff --cc docs/ref/settings.rst
index c46f2be6e,d96dfcd2a..26a409b5b
--- a/docs/ref/settings.rst
+++ b/docs/ref/settings.rst
@@@ -252,21 -252,6 +252,21 @@@ Default: ``'scrapy.item.ScrapedItem'`
The default class that will be used for instantiating items in the :ref:`the
Scrapy shell <topics-shell>`.
+.. setting:: DEFAULT_REQUEST_HEADERS
+
+DEFAULT_REQUEST_HEADERS
+-----------------------
+
+Default::
+
+ {
+ 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
+ 'Accept-Language': 'en',
+ }
+
+The default headers used for Scrapy HTTP Requests. They're populated in the
- DefaultHeadersMiddleware.
++:class:`~scrapy.contrib.downloadermiddleware.defaultheaders.DefaultHeadersMiddleware`.
+
.. setting:: DEFAULT_SPIDER
DEFAULT_SPIDER
@@@ -669,6 -655,51 +669,27 @@@ Default: ``Not Defined`
The name of the current project. It matches the project module name as created
by ``startproject`` command, and is only defined by project settings file.
+ .. setting:: REDIRECT_MAX_TIMES
+
+ REDIRECT_MAX_TIMES
+ ------------------
+
+ Default: ``20``
+
+ Defines the maximun times a request can be redirected. After this maximun the
+ request's response is returned as is. We used Firefox default value for the
+ same task.
+
+ .. setting:: REDIRECT_MAX_METAREFRESH_DELAY
+
+ REDIRECT_MAX_METAREFRESH_DELAY
----------------------------
++------------------------------
+
+ Default: ``100``
+
+ Some sites use meta-refresh for redirecting to a session expired page, so we
+ restrict automatic redirection to a maximum delay (in seconds)
+
-.. setting:: REQUEST_HEADER_ACCEPT
-
-REQUEST_HEADER_ACCEPT
----------------------
-
-Default: ``'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'``
-
-Default value to use for the ``Accept`` request header (if not already set
-before).
-
-See :ref:`ref-downloader-middleware-common`.
-
-.. setting:: REQUEST_HEADER_ACCEPT_LANGUAGE
-
-REQUEST_HEADER_ACCEPT_LANGUAGE
-------------------------------
-
-Default: ``'en'``
-
-Default value to use for the ``Accept-Language`` request header, if not already
-set before.
-
-See :ref:`ref-downloader-middleware-common`.
-
.. setting:: REQUESTS_QUEUE_SIZE
REQUESTS_PER_DOMAIN
diff --cc scrapy/conf/default_settings.py
index 742a15237,866124345..387d10f4b
--- a/scrapy/conf/default_settings.py
+++ b/scrapy/conf/default_settings.py
@@@ -140,8 -135,12 +139,9 @@@ NEWSPIDER_MODULE = '
PRIORITIZER = 'scrapy.core.prioritizers.RandomPrioritizer'
- REDIRECTMIDDLEWARE_MAX_TIMES = 20 # uses Firefox default setting
+ REDIRECT_MAX_METAREFRESH_DELAY = 100
+ REDIRECT_MAX_TIMES = 20 # uses Firefox default setting
-REQUEST_HEADER_ACCEPT = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
-REQUEST_HEADER_ACCEPT_LANGUAGE = 'en'
-
REQUESTS_QUEUE_SIZE = 0
REQUESTS_PER_DOMAIN = 8 # max simultaneous requests per domain