Commit b2d86c6
committed
Add self.retry_after to SparkRateLimitError class
If one sets the wait_on_rate_limit to True in their CiscoSparkAPI
class instantiation, they will hit an error telling them that
retry_after is not an attribute of the SparkRateLimitError class.
This is because the RestSession class checks for its existence
when it catches the error at line 282 in restsession.py
Error:
File "/home/daspano/../ciscosparkapi/restsession.py", line 282, in request
if self.wait_on_rate_limit and e.retry_after:
AttributeError: 'SparkRateLimitError' object has no attribute 'retry_after'
This commit adds that the retry_after attribute as an int, as my testing
shows the Retry-After result always being an integer in seconds.
Ex:
-----------------------------------Response------------------------------------
429 Too Many Requests
Date: Wed, 15 Nov 2017 21:47:00 GMT
Content-Type: application/json
Content-Length: 182
Connection: keep-alive
TrackingID: ROUTER_5A0CB5D2-B92F-01BB-7C3F-AC12D9227C3F
Cache-Control: no-cache
Retry-After: 194
Server: Redacted
l5d-success-class: 1.0
Via: 1.1 linkerd
content-encoding: gzip
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload1 parent efabff5 commit b2d86c6
2 files changed
+10
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
284 | | - | |
| 284 | + | |
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| |||
0 commit comments