From a8ac5869d019f545d9b8141a02aea0f8ed94a1b6 Mon Sep 17 00:00:00 2001 From: Lynne Date: Tue, 7 May 2019 03:02:42 +1000 Subject: [PATCH] added specific error for rate limit exceeded --- main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.py b/main.py index 877d482..89c97cc 100755 --- a/main.py +++ b/main.py @@ -196,6 +196,14 @@ for f in following: print('.', end='', flush=True) print(" Done!") db.commit() + except requests.HTTPError as e: + if e.response.status_code == 429: + print("Rate limit exceeded. This means we're downloading too many posts in quick succession. Saving toots to database and moving to next followed account.") + db.commit() + else: + # TODO: remove duplicate code + print("Encountered an error! Saving toots to database and moving to next followed account.") + db.commit() except: print("Encountered an error! Saving toots to database and moving to next followed account.") db.commit()