Log rate limit for statistics
This commit is contained in:
parent
c3ecb42f91
commit
45013b9939
@ -119,7 +119,13 @@ def extractStatusV2(url):
|
|||||||
if tweet.status_code == 429:
|
if tweet.status_code == 429:
|
||||||
# try another token
|
# try another token
|
||||||
continue
|
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()
|
output = tweet.json()
|
||||||
|
|
||||||
if "errors" in output:
|
if "errors" in output:
|
||||||
# try another token
|
# try another token
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user