Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/botocore/vendored/requests/exceptions.py: 81%
26 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 06:51 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 06:51 +0000
1# -*- coding: utf-8 -*-
3"""
4requests.exceptions
5~~~~~~~~~~~~~~~~~~~
7This module contains the set of Requests' exceptions.
9"""
10from .packages.urllib3.exceptions import HTTPError as BaseHTTPError
13class RequestException(IOError):
14 """There was an ambiguous exception that occurred while handling your
15 request."""
17 def __init__(self, *args, **kwargs):
18 """
19 Initialize RequestException with `request` and `response` objects.
20 """
21 response = kwargs.pop('response', None)
22 self.response = response
23 self.request = kwargs.pop('request', None)
24 if (response is not None and not self.request and
25 hasattr(response, 'request')):
26 self.request = self.response.request
27 super(RequestException, self).__init__(*args, **kwargs)
30class HTTPError(RequestException):
31 """An HTTP error occurred."""
34class ConnectionError(RequestException):
35 """A Connection error occurred."""
38class ProxyError(ConnectionError):
39 """A proxy error occurred."""
42class SSLError(ConnectionError):
43 """An SSL error occurred."""
46class Timeout(RequestException):
47 """The request timed out.
49 Catching this error will catch both
50 :exc:`~requests.exceptions.ConnectTimeout` and
51 :exc:`~requests.exceptions.ReadTimeout` errors.
52 """
55class ConnectTimeout(ConnectionError, Timeout):
56 """The request timed out while trying to connect to the remote server.
58 Requests that produced this error are safe to retry.
59 """
62class ReadTimeout(Timeout):
63 """The server did not send any data in the allotted amount of time."""
66class URLRequired(RequestException):
67 """A valid URL is required to make a request."""
70class TooManyRedirects(RequestException):
71 """Too many redirects."""
74class MissingSchema(RequestException, ValueError):
75 """The URL schema (e.g. http or https) is missing."""
78class InvalidSchema(RequestException, ValueError):
79 """See defaults.py for valid schemas."""
82class InvalidURL(RequestException, ValueError):
83 """ The URL provided was somehow invalid. """
86class ChunkedEncodingError(RequestException):
87 """The server declared chunked encoding but sent an invalid chunk."""
90class ContentDecodingError(RequestException, BaseHTTPError):
91 """Failed to decode response content"""
94class StreamConsumedError(RequestException, TypeError):
95 """The content for this response was already consumed"""
98class RetryError(RequestException):
99 """Custom retries logic failed"""