OLD | NEW |
(Empty) | |
| 1 # -*- coding: utf-8 -*- |
| 2 |
| 3 """ |
| 4 requests.exceptions |
| 5 ~~~~~~~~~~~~~~~~~~~ |
| 6 |
| 7 This module contains the set of Requests' exceptions. |
| 8 |
| 9 """ |
| 10 |
| 11 |
| 12 class RequestException(RuntimeError): |
| 13 """There was an ambiguous exception that occurred while handling your |
| 14 request.""" |
| 15 |
| 16 |
| 17 class HTTPError(RequestException): |
| 18 """An HTTP error occurred.""" |
| 19 |
| 20 def __init__(self, *args, **kwargs): |
| 21 """ Initializes HTTPError with optional `response` object. """ |
| 22 self.response = kwargs.pop('response', None) |
| 23 super(HTTPError, self).__init__(*args, **kwargs) |
| 24 |
| 25 |
| 26 class ConnectionError(RequestException): |
| 27 """A Connection error occurred.""" |
| 28 |
| 29 |
| 30 class SSLError(ConnectionError): |
| 31 """An SSL error occurred.""" |
| 32 |
| 33 |
| 34 class Timeout(RequestException): |
| 35 """The request timed out.""" |
| 36 |
| 37 |
| 38 class URLRequired(RequestException): |
| 39 """A valid URL is required to make a request.""" |
| 40 |
| 41 |
| 42 class TooManyRedirects(RequestException): |
| 43 """Too many redirects.""" |
| 44 |
| 45 |
| 46 class MissingSchema(RequestException, ValueError): |
| 47 """The URL schema (e.g. http or https) is missing.""" |
| 48 |
| 49 |
| 50 class InvalidSchema(RequestException, ValueError): |
| 51 """See defaults.py for valid schemas.""" |
| 52 |
| 53 |
| 54 class InvalidURL(RequestException, ValueError): |
| 55 """ The URL provided was somehow invalid. """ |
OLD | NEW |