<filename>src/ssp/news_scrape/news_scrape/middlewares/common.py
'''
Created on 09-Apr-2020

@author: srinivasan
'''
from scrapy.downloadermiddlewares.cookies import CookiesMiddleware


class CustomCookiesMiddleware(CookiesMiddleware):

    def process_request(self, request, spider):
        if 'dont_merge_cookies' in request.meta:
            return
        cookiejarkey = request.meta.get("cookiejar")
        jar = self.jars[cookiejarkey]
        jar.clear()  # custom line
        cookies = self._get_request_cookies(jar, request)
        for cookie in cookies:
            jar.set_cookie_if_ok(cookie, request)
        request.headers.pop('Cookie', None)
        jar.add_cookie_header(request)

        self._debug_cookie(request, spider)

<filename>src/ssp/news_scrape/news_scrape/middlewares/common.py
'''
Created on 09-Apr-2020

@author: srinivasan
'''
from scrapy.downloadermiddlewares.cookies import CookiesMiddleware


class CustomCookiesMiddleware(CookiesMiddleware):

    def process_request(self, request, spider):
        if 'dont_merge_cookies' in request.meta:
            return
        cookiejarkey = request.meta.get("cookiejar")
        jar = self.jars[cookiejarkey]
        jar.clear()  # custom line
        cookies = self._get_request_cookies(jar, request)
        for cookie in cookies:
            jar.set_cookie_if_ok(cookie, request)
        request.headers.pop('Cookie', None)
        jar.add_cookie_header(request)

        self._debug_cookie(request, spider)

Created on 09-Apr-2020  @author: srinivasan # custom line