Fix rate-limiting error

This commit is contained in:
Mike Crute 2020-06-01 23:12:05 -07:00
parent bbd08c72fe
commit 62262b6630
1 changed files with 7 additions and 5 deletions

View File

@ -89,11 +89,13 @@ class IdentityBrokerClient:
if ex.headers.get("Location") == "/logout":
raise Exception("Identity broker token is expired")
if res.status == 429:
self._logger.warning(
"Rate-limited by identity broker, sleeping 30 seconds")
time.sleep(30)
continue
if ex.status == 429:
self._logger.warning(
"Rate-limited by identity broker, sleeping 30 seconds")
time.sleep(30)
continue
raise ex
if res.status not in {200, 429}:
raise Exception(res.reason)