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.2~8^2~1^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f9e5521480e5b9fa760e0f19274441c363aca5e;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