mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-23 16:03:56 +00:00
Check 'dont_merge_cookies' membership in request.meta, instead of getting its value
This commit is contained in:
parent
e7a958a035
commit
bf467fc37a
@ -60,7 +60,7 @@ Request objects
|
||||
cookies for that domain and will be sent again in future requests. That's
|
||||
the typical behaviour of any regular web browser. However, if, for some
|
||||
reason, 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::
|
||||
|
@ -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:
|
||||
return
|
||||
|
||||
jar = 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user