diff --git a/3.0-HISTORY.rst b/3.0-HISTORY.rst index 4c4c84df..a65aad1f 100644 --- a/3.0-HISTORY.rst +++ b/3.0-HISTORY.rst @@ -23,6 +23,10 @@ - Streaming responses with ``Response.iter_lines`` or ``Response.iter_content`` now requires an encoding to be set if one isn't provided by the server. + +- Exception raised during read timeout for ``Response.iter_content`` and + ``Response.iter_lines`` changed from ``ConnectionError`` to more + specific ``ReadTimeout``. - Raise exception if multiple locations are returned during a redirect. diff --git a/requests/models.py b/requests/models.py index 8eab3f64..e776bc34 100644 --- a/requests/models.py +++ b/requests/models.py @@ -33,7 +33,7 @@ from .cookies import cookiejar_from_dict, get_cookie_header, _copy_cookie_jar from .exceptions import ( HTTPError, MissingScheme, InvalidURL, ChunkedEncodingError, ContentDecodingError, ConnectionError, StreamConsumedError, - InvalidHeader, InvalidBodyError) + InvalidHeader, InvalidBodyError, ReadTimeout) from ._internal_utils import to_native_string, unicode_is_ascii from .utils import ( guess_filename, get_auth_from_url, requote_uri, @@ -742,7 +742,7 @@ class Response(object): except DecodeError as e: raise ContentDecodingError(e) except ReadTimeoutError as e: - raise ConnectionError(e) + raise ReadTimeout(e) else: # Standard file-like object. while True: