diff options
Diffstat (limited to 'requests/exceptions.py')
-rw-r--r-- | requests/exceptions.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/requests/exceptions.py b/requests/exceptions.py index a4ee9d6..34c7a0d 100644 --- a/requests/exceptions.py +++ b/requests/exceptions.py @@ -44,7 +44,23 @@ class SSLError(ConnectionError): class Timeout(RequestException): - """The request timed out.""" + """The request timed out. + + Catching this error will catch both + :exc:`~requests.exceptions.ConnectTimeout` and + :exc:`~requests.exceptions.ReadTimeout` errors. + """ + + +class ConnectTimeout(ConnectionError, Timeout): + """The request timed out while trying to connect to the remote server. + + Requests that produced this error are safe to retry. + """ + + +class ReadTimeout(Timeout): + """The server did not send any data in the allotted amount of time.""" class URLRequired(RequestException): @@ -73,3 +89,6 @@ class ChunkedEncodingError(RequestException): class ContentDecodingError(RequestException, BaseHTTPError): """Failed to decode response content""" + +class StreamConsumedError(RequestException, TypeError): + """The content for this response was already consumed""" |