From: Chase Sterling Date: Thu, 14 Feb 2013 06:05:42 +0000 (-0500) Subject: Allow RequestsCookieJar to be updated with cookies from a CookieJar X-Git-Tag: v1.2.0~42^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=87d9d9643c73d6fc7f701263e5c4e93217db022f;p=services%2Fpython-requests.git Allow RequestsCookieJar to be updated with cookies from a CookieJar --- diff --git a/requests/cookies.py b/requests/cookies.py index eb6c314..365728a 100644 --- a/requests/cookies.py +++ b/requests/cookies.py @@ -258,6 +258,14 @@ class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping): """Deletes a cookie given a name. Wraps cookielib.CookieJar's remove_cookie_by_name().""" remove_cookie_by_name(self, name) + def update(self, other): + """Updates this jar with cookies from another CookieJar or dict-like""" + if isinstance(other, cookielib.CookieJar): + for cookie in other: + self.set_cookie(cookie) + else: + super(RequestsCookieJar, self).update(other) + def _find(self, name, domain=None, path=None): """Requests uses this method internally to get cookie values. Takes as args name and optional domain and path. Returns a cookie.value. If there are conflicting cookies,