diff --git a/docs/topics/downloader-middleware.rst b/docs/topics/downloader-middleware.rst index 515108d9d..2a17620bd 100644 --- a/docs/topics/downloader-middleware.rst +++ b/docs/topics/downloader-middleware.rst @@ -277,7 +277,7 @@ Direct access to cookiejars from spider In some cases it is required to directly set specific values in an existing cookiejar. -.. skip: next +.. skip: start .. code-block:: python import scrapy @@ -309,6 +309,8 @@ cookiejar. p.crawl(Quotes) p.start() +.. skip: end + .. note:: If :reqmeta:`cookiejar` didn't specified in request meta, middleware will read this as ``None``, as result of this middleware will create cookiejar object under dict key ``None``. @@ -340,7 +342,7 @@ If cookie middleware is enabled, ``get_cookiejar(response_or_request)`` method a It allows a bit easier access to cookiejar object: - .. skip: next + .. skip: start .. code-block:: python ... @@ -349,6 +351,7 @@ If cookie middleware is enabled, ``get_cookiejar(response_or_request)`` method a locale_cookie = ( self.get_cookiejar(response).jar._cookies["quotes.toscrape.com"]["/"].get("session") ) + .. skip: end Known use cases where direct access to cookiejar objects can be useful: