From 65f40c9a5aba3529607cd4b58708b423a5953ad5 Mon Sep 17 00:00:00 2001 From: Vlad Pronsky Date: Tue, 4 Jul 2023 15:20:53 +0300 Subject: [PATCH] fix: handle 401 error as normal situation and switch account --- twscrape/queue_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/twscrape/queue_client.py b/twscrape/queue_client.py index 420a46f..08c5c9a 100644 --- a/twscrape/queue_client.py +++ b/twscrape/queue_client.py @@ -111,9 +111,9 @@ class QueueClient: continue # possible account banned - if rep.status_code == 403: - logger.warning(f"403 for {log_id}") + if rep.status_code in (401, 403): reset_ts = utc_ts() + 60 * 60 # + 1 hour + logger.warning(f"Code {rep.status_code} for {log_id} – frozen for 1h") await self.pool.lock_until(ctx.acc.username, self.queue, reset_ts) continue