Scrapy, a fast high-level web crawling & scraping framework for Python.
Check 'dont_merge_cookies' membership in request.meta, instead of getting its value
Pablo Hoffmanbf467fc37a91
diff --git a/docs/topics/request-response.rst b/docs/topics/request-response.rstindex 8bdbd52e4..bf9acf653 100644--- a/docs/topics/request-response.rst+++ b/docs/topics/request-response.rst@@ -60,7 +60,7 @@ Request objectscookies for that domain and will be sent again in future requests. That'sthe typical behaviour of any regular web browser. However, if, for somereason, you want to avoid merging with existing cookies you can instruct- Scrapy to do so by setting the ``dont_merge_cookies`` item in the+ Scrapy to do so by setting the ``dont_merge_cookies`` key in the:attr:`Request.meta`.Example of request without merging cookies::diff --git a/scrapy/contrib/downloadermiddleware/cookies.py b/scrapy/contrib/downloadermiddleware/cookies.pyindex 09eb18ece..b99c4b338 100644--- a/scrapy/contrib/downloadermiddleware/cookies.py+++ b/scrapy/contrib/downloadermiddleware/cookies.py@@ -17,7 +17,7 @@ class CookiesMiddleware(object):dispatcher.connect(self.spider_closed, signals.spider_closed)def process_request(self, request, spider):- if request.meta.get('dont_merge_cookies', False):+ if 'dont_merge_cookies' in request.meta:returnjar = self.jars[spider]@@ -31,7 +31,7 @@ class CookiesMiddleware(object):self._debug_cookie(request)def process_response(self, request, response, spider):- if request.meta.get('dont_merge_cookies', False):+ if 'dont_merge_cookies' in request.meta:return response# extract cookies from Set-Cookie and drop invalid/expired cookies