From ec763544f1094530d68217c9e25d80b8c270c273 Mon Sep 17 00:00:00 2001 From: Son Date: Sat, 19 Jun 2021 19:56:18 +0200 Subject: [PATCH] handle 429 returned by HIBP --- cron.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cron.py b/cron.py index 3b93a639..3f3c09ef 100644 --- a/cron.py +++ b/cron.py @@ -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