python (3.11.7)
       1  """
       2  requests.exceptions
       3  ~~~~~~~~~~~~~~~~~~~
       4  
       5  This module contains the set of Requests' exceptions.
       6  """
       7  from pip._vendor.urllib3.exceptions import HTTPError as BaseHTTPError
       8  
       9  from .compat import JSONDecodeError as CompatJSONDecodeError
      10  
      11  
      12  class ESC[4;38;5;81mRequestException(ESC[4;38;5;149mIOError):
      13      """There was an ambiguous exception that occurred while handling your
      14      request.
      15      """
      16  
      17      def __init__(self, *args, **kwargs):
      18          """Initialize RequestException with `request` and `response` objects."""
      19          response = kwargs.pop("response", None)
      20          self.response = response
      21          self.request = kwargs.pop("request", None)
      22          if response is not None and not self.request and hasattr(response, "request"):
      23              self.request = self.response.request
      24          super().__init__(*args, **kwargs)
      25  
      26  
      27  class ESC[4;38;5;81mInvalidJSONError(ESC[4;38;5;149mRequestException):
      28      """A JSON error occurred."""
      29  
      30  
      31  class ESC[4;38;5;81mJSONDecodeError(ESC[4;38;5;149mInvalidJSONError, ESC[4;38;5;149mCompatJSONDecodeError):
      32      """Couldn't decode the text into json"""
      33  
      34      def __init__(self, *args, **kwargs):
      35          """
      36          Construct the JSONDecodeError instance first with all
      37          args. Then use it's args to construct the IOError so that
      38          the json specific args aren't used as IOError specific args
      39          and the error message from JSONDecodeError is preserved.
      40          """
      41          CompatJSONDecodeError.__init__(self, *args)
      42          InvalidJSONError.__init__(self, *self.args, **kwargs)
      43  
      44  
      45  class ESC[4;38;5;81mHTTPError(ESC[4;38;5;149mRequestException):
      46      """An HTTP error occurred."""
      47  
      48  
      49  class ESC[4;38;5;81mConnectionError(ESC[4;38;5;149mRequestException):
      50      """A Connection error occurred."""
      51  
      52  
      53  class ESC[4;38;5;81mProxyError(ESC[4;38;5;149mConnectionError):
      54      """A proxy error occurred."""
      55  
      56  
      57  class ESC[4;38;5;81mSSLError(ESC[4;38;5;149mConnectionError):
      58      """An SSL error occurred."""
      59  
      60  
      61  class ESC[4;38;5;81mTimeout(ESC[4;38;5;149mRequestException):
      62      """The request timed out.
      63  
      64      Catching this error will catch both
      65      :exc:`~requests.exceptions.ConnectTimeout` and
      66      :exc:`~requests.exceptions.ReadTimeout` errors.
      67      """
      68  
      69  
      70  class ESC[4;38;5;81mConnectTimeout(ESC[4;38;5;149mConnectionError, ESC[4;38;5;149mTimeout):
      71      """The request timed out while trying to connect to the remote server.
      72  
      73      Requests that produced this error are safe to retry.
      74      """
      75  
      76  
      77  class ESC[4;38;5;81mReadTimeout(ESC[4;38;5;149mTimeout):
      78      """The server did not send any data in the allotted amount of time."""
      79  
      80  
      81  class ESC[4;38;5;81mURLRequired(ESC[4;38;5;149mRequestException):
      82      """A valid URL is required to make a request."""
      83  
      84  
      85  class ESC[4;38;5;81mTooManyRedirects(ESC[4;38;5;149mRequestException):
      86      """Too many redirects."""
      87  
      88  
      89  class ESC[4;38;5;81mMissingSchema(ESC[4;38;5;149mRequestException, ESC[4;38;5;149mValueError):
      90      """The URL scheme (e.g. http or https) is missing."""
      91  
      92  
      93  class ESC[4;38;5;81mInvalidSchema(ESC[4;38;5;149mRequestException, ESC[4;38;5;149mValueError):
      94      """The URL scheme provided is either invalid or unsupported."""
      95  
      96  
      97  class ESC[4;38;5;81mInvalidURL(ESC[4;38;5;149mRequestException, ESC[4;38;5;149mValueError):
      98      """The URL provided was somehow invalid."""
      99  
     100  
     101  class ESC[4;38;5;81mInvalidHeader(ESC[4;38;5;149mRequestException, ESC[4;38;5;149mValueError):
     102      """The header value provided was somehow invalid."""
     103  
     104  
     105  class ESC[4;38;5;81mInvalidProxyURL(ESC[4;38;5;149mInvalidURL):
     106      """The proxy URL provided is invalid."""
     107  
     108  
     109  class ESC[4;38;5;81mChunkedEncodingError(ESC[4;38;5;149mRequestException):
     110      """The server declared chunked encoding but sent an invalid chunk."""
     111  
     112  
     113  class ESC[4;38;5;81mContentDecodingError(ESC[4;38;5;149mRequestException, ESC[4;38;5;149mBaseHTTPError):
     114      """Failed to decode response content."""
     115  
     116  
     117  class ESC[4;38;5;81mStreamConsumedError(ESC[4;38;5;149mRequestException, ESC[4;38;5;149mTypeError):
     118      """The content for this response was already consumed."""
     119  
     120  
     121  class ESC[4;38;5;81mRetryError(ESC[4;38;5;149mRequestException):
     122      """Custom retries logic failed"""
     123  
     124  
     125  class ESC[4;38;5;81mUnrewindableBodyError(ESC[4;38;5;149mRequestException):
     126      """Requests encountered an error when trying to rewind a body."""
     127  
     128  
     129  # Warnings
     130  
     131  
     132  class ESC[4;38;5;81mRequestsWarning(ESC[4;38;5;149mWarning):
     133      """Base warning for Requests."""
     134  
     135  
     136  class ESC[4;38;5;81mFileModeWarning(ESC[4;38;5;149mRequestsWarning, ESC[4;38;5;149mDeprecationWarning):
     137      """A file was opened in text mode, but Requests determined its binary length."""
     138  
     139  
     140  class ESC[4;38;5;81mRequestsDependencyWarning(ESC[4;38;5;149mRequestsWarning):
     141      """An imported dependency doesn't match the expected version range."""