|
26 | 26 | * Author(s): Brent Rubell
|
27 | 27 | """
|
28 | 28 |
|
| 29 | + |
29 | 30 | class AdafruitIO_ThrottleError(Exception):
|
30 | 31 | """Adafruit IO request error class for rate-limiting"""
|
| 32 | + |
31 | 33 | def __init__(self):
|
32 |
| - super(AdafruitIO_ThrottleError, self).__init__("Number of Adafruit IO Requests exceeded! \ |
33 |
| - Please try again in 30 seconds..") |
| 34 | + super(AdafruitIO_ThrottleError, self).__init__( |
| 35 | + "Number of Adafruit IO Requests exceeded! \ |
| 36 | + Please try again in 30 seconds.." |
| 37 | + ) |
| 38 | + |
34 | 39 |
|
35 | 40 | class AdafruitIO_RequestError(Exception):
|
36 | 41 | """Adafruit IO request error class"""
|
| 42 | + |
37 | 43 | def __init__(self, response):
|
38 | 44 | response_content = response.json()
|
39 |
| - error = response_content['error'] |
40 |
| - super(AdafruitIO_RequestError, self).__init__("Adafruit IO Error {0}: {1}" |
41 |
| - .format(response.status_code, error)) |
| 45 | + error = response_content["error"] |
| 46 | + super(AdafruitIO_RequestError, self).__init__( |
| 47 | + "Adafruit IO Error {0}: {1}".format(response.status_code, error) |
| 48 | + ) |
| 49 | + |
42 | 50 |
|
43 | 51 | class AdafruitIO_MQTTError(Exception):
|
44 | 52 | """Adafruit IO MQTT error class"""
|
| 53 | + |
45 | 54 | def __init__(self, response):
|
46 |
| - super(AdafruitIO_MQTTError, self).__init__('MQTT Error: {0}'.format(response)) |
| 55 | + super(AdafruitIO_MQTTError, self).__init__("MQTT Error: {0}".format(response)) |
0 commit comments