From ee80b1bcc0147b2310cd49648a8f88c3218261f0 Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Sat, 28 Feb 2009 03:04:31 +0000 Subject: [PATCH] added doc about 'dont_merge_cookies' recently added by Damian --HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40940 --- scrapy/trunk/docs/ref/request-response.rst | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scrapy/trunk/docs/ref/request-response.rst b/scrapy/trunk/docs/ref/request-response.rst index 000dc0e72..478c5b194 100644 --- a/scrapy/trunk/docs/ref/request-response.rst +++ b/scrapy/trunk/docs/ref/request-response.rst @@ -48,12 +48,24 @@ Request objects ``headers`` is a multi-valued dict containing the headers of this request - ``cookies`` is a dict containing the request cookies, and will be preserved - for the rest of the domain crawl, like any browser would do. Example:: + ``cookies`` is a dict containing the request cookies. Example:: request_with_cookies = Request(url="http://www.example.com", cookies={currency: 'USD', country: 'UY'}) + When some site returns cookies (in a response) those are stored in the + 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 + Request.meta. + + Example of request without merging cookies:: + + request_with_cookies = Request(url="http://www.example.com", + cookies={currency: 'USD', country: 'UY'}, + meta={'dont_merge_cookies': True}) + ``encoding`` is a string with the encoding of this request. This encoding will be used to percent-encode the URL and to convert the body to str (when given as unicode).