def bind(self, r): """Bind the Request to another one. This method will copy the supplied request's cookies and response set-cookies to the Request.""" r_new = self.copy() for c in r.get_header('Cookie'): r_new.add_header('Cookie', c) if r.response: cookies = [] for c in r.response.get_header('Set-Cookie'): cookies.append(Cookie.parse(c, set_cookie=True)) r_new.add_header('Cookie', "; ".join([str(x) for x in cookies])) return r_new
def cookies(self): cookies = [] for h in self.get_header("Cookie"): cookies.extend(Cookie.parse(h)) return cookies
def cookies(self): cookies = [] for h in self.get_header("Set-Cookie"): cookies.append(Cookie.parse(h, set_cookie=True)) return cookies