cookie_dict = {} from scrapy.http.cookies import CookieJar cookie_jar = CookieJar() cookie_jar.extract_cookies(response, response.request) # logging.info(' cookie_jar._cookies %s', cookie_jar._cookies) for k, v in cookie_jar._cookies.items(): for i, j in v.items(): for m, n in j.items(): cookie_dict[m] = n.value
cookie_jar.extract_cookies(response, response.request) cookies = {} for cookies_item in cookie_jar: cookies.update({cookies_item.name: cookies_item.value})