Scrapy, a fast high-level web crawling & scraping framework for Python.
Improve the docs about Crawler attributes and settings initialization.
Andrey Rakhmatullin603aa4924afc
diff --git a/docs/news.rst b/docs/news.rstindex 5db37969c..65d9c5181 100644--- a/docs/news.rst+++ b/docs/news.rst@@ -32,8 +32,10 @@ Backward-incompatible changes:meth:`scrapy.crawler.Crawler.__init__` and before the settings arefinalized and frozen. This change was needed to allow changing the settingsin :meth:`scrapy.Spider.from_crawler`. If you want to access the final- setting values in the spider code as early as possible you can do this in- :meth:`~scrapy.Spider.start_requests`. (:issue:`6038`)+ setting values and the initialized :class:`~scrapy.crawler.Crawler`+ attributes in the spider code as early as possible you can do this in+ :meth:`~scrapy.Spider.start_requests` or in a handler of the+ :signal:`engine_started` signal. (:issue:`6038`)- The :meth:`TextResponse.json <scrapy.http.TextResponse.json>` method nowrequires the response to be in a valid JSON encoding (UTF-8, UTF-16, ordiff --git a/docs/topics/spiders.rst b/docs/topics/spiders.rstindex 20452d558..30677fe74 100644--- a/docs/topics/spiders.rst+++ b/docs/topics/spiders.rst@@ -142,8 +142,14 @@ scrapy.Spidermethod, which is handy if you want to modify them based onarguments. As a consequence, these settings aren't the final valuesas they can be modified later by e.g. :ref:`add-ons- <topics-addons>`. The final settings are available in the- :meth:`start_requests` method and later.+ <topics-addons>`. For the same reason, most of the+ :class:`~scrapy.crawler.Crawler` attributes aren't initialized at+ this point.++ The final settings and the initialized+ :class:`~scrapy.crawler.Crawler` attributes are available in the+ :meth:`start_requests` method, handlers of the+ :signal:`engine_started` signal and later.:param crawler: crawler to which the spider will be bound:type crawler: :class:`~scrapy.crawler.Crawler` instance