From: Kunal Mehta Date: Mon, 1 Oct 2012 00:24:56 +0000 (-0500) Subject: Use __iter__ rather than the inefficient nested for loops X-Git-Tag: v0.14.1~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5cd116d078ca885f81c89390d1e5ebe8cd7f5068;p=services%2Fpython-requests.git Use __iter__ rather than the inefficient nested for loops --- diff --git a/requests/utils.py b/requests/utils.py index eb14600..63b281a 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -311,11 +311,8 @@ def dict_from_cookiejar(cj): cookie_dict = {} - for _, cookies in list(cj._cookies.items()): - for _, cookies in list(cookies.items()): - for cookie in list(cookies.values()): - # print cookie - cookie_dict[cookie.name] = cookie.value + for cookie in cj: + cookie_dict[cookie.name] = cookie.value return cookie_dict