Skip to content

Commit 13128e2

Browse files
committed
Ensure the initializer for the parent exception classes are called
Ensure the initializer `super().__init__()` for the parent classes in exception hierarchy are called, and update the comments and docstrings just for consistency.
1 parent b2d86c6 commit 13128e2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ciscosparkapi/exceptions.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,13 @@ class SparkRateLimitError(SparkApiError):
142142
"""Cisco Spark Rate-Limit exceeded Error."""
143143

144144
def __init__(self, response):
145-
assert isinstance(response, requests.Response)
146-
147-
# Set a sane default just incase Spark lets us down
148-
self.retry_after = 200
145+
super(SparkRateLimitError, self).__init__(response)
149146

150-
if 'Retry-After' in response.headers.keys():
151-
self.retry_after = int(response.headers['Retry-After'])
147+
# Extended exception data attributes
148+
self.retry_after = response.headers.get('Retry-After', 200)
149+
"""The `Retry-After` time period (in seconds) provided by Cisco Spark.
150+
151+
Defaults to 200 seconds if the response `Retry-After` header isn't
152+
present in the response headers.
153+
154+
"""

0 commit comments

Comments
 (0)