From: Kenneth Reitz Date: Fri, 9 Mar 2012 16:56:41 +0000 (-0800) Subject: catch cookie errors that are prone to failure X-Git-Tag: v0.10.8~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d078b69aefc24ec6fc52fcaf4334c2573e5168fc;p=services%2Fpython-requests.git catch cookie errors that are prone to failure --- diff --git a/requests/utils.py b/requests/utils.py index 6ee227a..6952a99 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -14,6 +14,7 @@ import codecs import os import random import re +import traceback import zlib from netrc import netrc, NetrcParseError @@ -61,11 +62,15 @@ def dict_from_string(s): cookies = dict() - c = SimpleCookie() - c.load(s) + try: + c = SimpleCookie() + c.load(s) - for k, v in list(c.items()): - cookies.update({k: v.value}) + for k, v in list(c.items()): + cookies.update({k: v.value}) + # This stuff is not to be trusted. + except Exception: + pass return cookies