Scrapy, a fast high-level web crawling & scraping framework for Python.
Merge branch 'master' into documentation-build
Adrián Chaves1006db1e10ab
diff --cc docs/topics/link-extractors.rstindex 13b9ad7a5,0162a331a..ed32411b0--- a/docs/topics/link-extractors.rst+++ b/docs/topics/link-extractors.rst@@@ -59,13 -46,13 +46,13 @@@ LxmlLinkExtracto:param allow: a single regular expression (or list of regular expressions)that the (absolute) urls must match in order to be extracted. If notgiven (or empty), it will match all links.- :type allow: a regular expression (or list of)+ :type allow: str or list:param deny: a single regular expression (or list of regular expressions)- that the (absolute) urls must match in order to be excluded (ie. not+ that the (absolute) urls must match in order to be excluded (i.e. notextracted). It has precedence over the ``allow`` parameter. If notgiven (or empty) it won't exclude any links.- :type deny: a regular expression (or list of)+ :type deny: str or list:param allow_domains: a single value or a list of string containingdomains which will be considered for extracting the links@@@ -150,6 -141,8 +141,8 @@@elements, etc., so LinkExtractor strips space chars by default.Set ``strip=False`` to turn it off (e.g. if you're extracting urlsfrom elements or attributes which allow leading/trailing whitespaces).- :type strip: boolean+ :type strip: bool+ .. automethod:: extract_links+.. _scrapy.linkextractors: https://github.com/scrapy/scrapy/blob/master/scrapy/linkextractors/__init__.pydiff --cc docs/topics/loaders.rstindex 4137fdd24,5f75ccbff..44f510ce1--- a/docs/topics/loaders.rst+++ b/docs/topics/loaders.rst@@@ -320,13 -313,13 +313,13 @@@ ItemLoader object:param re: a regular expression to use for extracting data from thegiven value using :meth:`~scrapy.utils.misc.extract_regex` method,applied before processors- :type re: str or compiled regex+ :type re: str or typing.Pattern- Examples::+ Examples:- >>> from scrapy.loader.processors import TakeFirst- >>> loader.get_value(u'name: foo', TakeFirst(), unicode.upper, re='name: (.+)')- 'FOO`+ >>> from scrapy.loader.processors import TakeFirst+ >>> loader.get_value(u'name: foo', TakeFirst(), unicode.upper, re='name: (.+)')+ 'FOO`.. method:: add_value(field_name, value, \*processors, \**kwargs)diff --cc docs/topics/request-response.rstindex 2f99a72f5,024f46466..1638c202d--- a/docs/topics/request-response.rst+++ b/docs/topics/request-response.rst@@@ -31,10 -31,12 +31,12 @@@ Request objecta :class:`Response`.:param url: the URL of this request++ If the URL is invalid, a :exc:`ValueError` exception is raised.- :type url: string+ :type url: str:param callback: the function that will be called with the response of this- request (once its downloaded) as its first parameter. For more information+ request (once it's downloaded) as its first parameter. For more informationsee :ref:`topics-request-response-ref-request-callback-arguments` below.If a Request doesn't specify a callback, the spider's:meth:`~scrapy.spiders.Spider.parse` method will be used.@@@ -121,11 -123,15 +123,15 @@@:param errback: a function that will be called if any exception wasraised while processing the request. This includes pages that failed- with 404 HTTP errors and such. It receives a `Twisted Failure`_ instance- as first parameter.+ with 404 HTTP errors and such. It receives a+ :exc:`~twisted.python.failure.Failure` as first parameter.For more information,see :ref:`topics-request-response-ref-errbacks` below.++ .. versionchanged:: 2.0+ The *callback* parameter is no longer required when the *errback*+ parameter is specified.- :type errback: callable+ :type errback: collections.abc.Callable:param flags: Flags sent to the request, can be used for logging or similar purposes.:type flags: list@@@ -470,10 -474,10 +474,10 @@@ fields with form data from :class:`Resp:param dont_click: If True, the form data will be submitted withoutclicking in any element.- :type dont_click: boolean+ :type dont_click: boolThe other parameters of this class method are passed directly to the- :class:`FormRequest` constructor.+ :class:`FormRequest` ``__init__`` method... versionadded:: 0.10.3The ``formname`` parameter.@@@ -556,11 -560,11 +560,11 @@@ dealing with JSON requests:param data: is any JSON serializable object that needs to be JSON encoded and assigned to body.if :attr:`Request.body` argument is provided this parameter will be ignored.- if :attr:`Request.body` argument is not provided and data argument is provided :attr:`Request.method` will be+ if :attr:`Request.body` argument is not provided and data argument is provided :attr:`Request.method` will beset to ``'POST'`` automatically.- :type data: JSON serializable object+ :type data: object- :param dumps_kwargs: Parameters that will be passed to underlying `json.dumps`_ method which is used to serialize+ :param dumps_kwargs: Parameters that will be passed to underlying :func:`json.dumps` method which is used to serializedata into JSON format.:type dumps_kwargs: dictdiff --cc scrapy/crawler.pyindex 84acf543f,6f43771e2..d427bec75--- a/scrapy/crawler.py+++ b/scrapy/crawler.py@@@ -292,9 -307,10 +307,10 @@@ class CrawlerProcess(CrawlerRunner)If ``stop_after_crawl`` is True, the reactor will be stopped after allcrawlers have finished, using :meth:`join`.- :param boolean stop_after_crawl: stop or not the reactor when all+ :param bool stop_after_crawl: stop or not the reactor when allcrawlers have finished"""+ from twisted.internet import reactorif stop_after_crawl:d = self.join()# Don't start the reactor if the deferreds are already fireddiff --cc scrapy/settings/__init__.pyindex d1a5093a6,b9a13c018..8f6fd3e6a--- a/scrapy/settings/__init__.py+++ b/scrapy/settings/__init__.py@@@ -173,13 -166,13 +166,13 @@@ class BaseSettings(MutableMapping)``'one,two'`` will return a list ['one', 'two'] when using this method.:param name: the setting name- :type name: string+ :type name: str:param default: the value to return if no setting is found- :type default: any+ :type default: object"""value = self.get(name, default or [])- if isinstance(value, six.string_types):+ if isinstance(value, str):value = value.split(',')return list(value)@@@ -194,13 -187,13 +187,13 @@@and losing all information about priority and mutability.:param name: the setting name- :type name: string+ :type name: str:param default: the value to return if no setting is found- :type default: any+ :type default: object"""value = self.get(name, default or {})- if isinstance(value, six.string_types):+ if isinstance(value, str):value = json.loads(value)return dict(value)@@@ -287,10 -280,10 +280,10 @@@:param priority: the priority of the settings. Should be a key of:attr:`~scrapy.settings.SETTINGS_PRIORITIES` or an integer- :type priority: string or int+ :type priority: str or int"""self._assert_mutability()- if isinstance(module, six.string_types):+ if isinstance(module, str):module = import_module(module)for key in dir(module):if key.isupper():@@@ -316,10 -309,10 +309,10 @@@:param priority: the priority of the settings. Should be a key of:attr:`~scrapy.settings.SETTINGS_PRIORITIES` or an integer- :type priority: string or int+ :type priority: str or int"""self._assert_mutability()- if isinstance(values, six.string_types):+ if isinstance(values, str):values = json.loads(values)if values is not None:if isinstance(values, BaseSettings):