From faf61082bbf812c482f6668d740180211d3d8b33 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 3 Apr 2024 19:33:28 +0200 Subject: [PATCH] Add logs to pushbullet alerting code --- discogs_alert/alert/pushbullet.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/discogs_alert/alert/pushbullet.py b/discogs_alert/alert/pushbullet.py index 507460d..a2163b8 100644 --- a/discogs_alert/alert/pushbullet.py +++ b/discogs_alert/alert/pushbullet.py @@ -20,6 +20,7 @@ def get_all_alerts(self) -> AlertDict: resp = requests.get(url, headers=headers) rate_limit_remaining = int(resp.headers.get("X-Ratelimit-Remaining")) while rate_limit_remaining < 2: + logger.info("About to hit pushbullet's rate limit, waiting 60s") time.sleep(60) resp = requests.get(url, headers=headers) rate_limit_remaining = int(resp.headers.get("X-Ratelimit-Remaining")) @@ -29,6 +30,7 @@ def get_all_alerts(self) -> AlertDict: cursor = None while cursor is not None: if rate_limit_remaining < 2: + logger.info("About to hit pushbullet's rate limit, waiting 60s") time.sleep(60) resp = requests.get(url + f"&cursor={cursor}", headers=headers) rate_limit_remaining = int(resp.headers.get("X-Ratelimit-Remaining"))