diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e881bd7..2a3ba95 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,7 +27,7 @@ jobs: cache: 'npm' - name: Install packages - run: npm install -g serverless + run: npm install -g serverless@3.25.1 - name: Install serverless-wsgi run: serverless plugin install -n serverless-wsgi diff --git a/twExtract/__init__.py b/twExtract/__init__.py index 30ab58b..54bd3a6 100644 --- a/twExtract/__init__.py +++ b/twExtract/__init__.py @@ -57,6 +57,11 @@ def cycleBearerTokenGet(url,headers): # try another bearer token print(f"Error 429 but {rateLimitRemaining} remaining") continue + else: + # move successful token to the front if it's not already there + if token != bearerTokens[0]: + bearerTokens.insert(0,bearerTokens.pop(bearerTokens.index(token))) + return tweet except Exception as e: pass return tweet