From 925e975295e2fe772268e748c6c074af7b0ae47d Mon Sep 17 00:00:00 2001 From: daftshady Date: Tue, 16 Dec 2014 16:55:13 +0900 Subject: [PATCH] catch exception more specifically in Response.ok --- requests/models.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/requests/models.py b/requests/models.py index 2370b67f..17ff4660 100644 --- a/requests/models.py +++ b/requests/models.py @@ -22,9 +22,8 @@ from .packages.urllib3.util import parse_url from .packages.urllib3.exceptions import ( DecodeError, ReadTimeoutError, ProtocolError) from .exceptions import ( - HTTPError, RequestException, MissingSchema, InvalidURL, - ChunkedEncodingError, ContentDecodingError, ConnectionError, - StreamConsumedError) + HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError, + ContentDecodingError, ConnectionError, StreamConsumedError) from .utils import ( guess_filename, get_auth_from_url, requote_uri, stream_decode_response_unicode, to_key_val_list, parse_header_links, @@ -615,7 +614,7 @@ class Response(object): def ok(self): try: self.raise_for_status() - except RequestException: + except HTTPError: return False return True