<s> from scrapy . contrib . downloadermiddleware . cookies import CookiesMiddleware <EOL> class CustomCookiesMiddleware ( CookiesMiddleware ) : <EOL> '''<STR_LIT>''' <EOL> def process_request ( self , request , spider ) : <EOL> if '<STR_LIT>' in request . meta : <EOL> return <EOL> cookiejarkey = request . meta . get ( "<STR_LIT>" ) <EOL> jar = self . jars [ cookiejarkey ] <EOL> jar . clear ( ) <EOL> cookies = self . _get_request_cookies ( jar , request ) <EOL> for cookie in cookies : <EOL> jar . set_cookie_if_ok ( cookie , request ) <EOL> request . headers . pop ( '<STR_LIT>' , None ) <EOL> jar . add_cookie_header ( request ) <EOL> self . _debug_cookie ( request , spider ) </s>
