handle 429 returned by HIBP

This commit is contained in:
Son 2021-06-19 19:56:18 +02:00
parent 38de6118ee
commit ec763544f1
1 changed files with 5 additions and 0 deletions

View File

@ -801,6 +801,11 @@ async def _hibp_check(api_key, queue):
elif r.status_code == 404:
# No breaches found
alias.hibp_breaches = []
elif r.status_code == 429:
# rate limited
LOG.w("HIBP rate limited, check alias %s in the next run", alias)
await asyncio.sleep(1.6)
return
elif r.status_code > 500:
LOG.w("HIBP server 5** error %s", r.status_code)
return