Log rate limit for statistics

This commit is contained in:
Dylan 2023-07-15 16:34:28 +01:00
parent c3ecb42f91
commit 45013b9939

View File

@ -119,7 +119,13 @@ def extractStatusV2(url):
if tweet.status_code == 429:
# try another token
continue
try:
rateLimitRemaining = tweet.headers.get("x-rate-limit-remaining")
print(f"Twitter Token Rate limit remaining: {rateLimitRemaining}")
except: # for some reason the header is not always present
pass
output = tweet.json()
if "errors" in output:
# try another token
continue