From 0adaae53aa0beab96debf3c32d07b76df6f316bb Mon Sep 17 00:00:00 2001 From: Watchful1 Date: Thu, 21 Sep 2023 16:32:25 -0700 Subject: [PATCH] Handle the incorrect reauth --- personal/combine/merge_and_backfill.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/personal/combine/merge_and_backfill.py b/personal/combine/merge_and_backfill.py index e42c937..f41a12d 100644 --- a/personal/combine/merge_and_backfill.py +++ b/personal/combine/merge_and_backfill.py @@ -52,9 +52,19 @@ def re_auth_pushshift(old_token): discord_logging.flush_discord() return new_token elif 'detail' in result: + if result['detail'] == 'Access token is still active and can not be refreshed.': + log.warning(f"Access token still active, trying request again") + time.sleep(5) + return old_token + log.warning(f"Reauth failed: {result['detail']}") discord_logging.flush_discord() sys.exit(1) + else: + log.warning(f"Something went wrong re-authing") + discord_logging.flush_discord() + sys.exit(1) + def query_pushshift(ids, bearer, object_type):