Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rate Limit Not Pulling? #1950

Open
NovemberFalls opened this issue Aug 25, 2022 · 2 comments
Open

Rate Limit Not Pulling? #1950

NovemberFalls opened this issue Aug 25, 2022 · 2 comments
Labels
API This is regarding Twitter's API

Comments

@NovemberFalls
Copy link

Howdy everyone,
hope all is well with you and yours. Not too long ago the calls for the rate limit were working. I changed apps, regenerated keys several times, and it doesn't matter how many times I configure / look at it, it seems as if my rate limits never go down. That being said, I do get rate limited. I have elevated access and I am using the following calls to check for rate limits.

` twitter_auth_keys = {
"consumer_key" : Auth_Codes.consumer_key,
"consumer_secret" : Auth_Codes.consumer_secret,
"access_token" : Auth_Codes.access_token,
"access_token_secret" : Auth_Codes.access_token_secret
}
auth = tweepy.OAuthHandler(
twitter_auth_keys["consumer_key"],
twitter_auth_keys["consumer_secret"]
)

auth.set_access_token(
    twitter_auth_keys["access_token"],
    twitter_auth_keys["access_token_secret"]
)

api = tweepy.API(auth,wait_on_rate_limit=True,retry_count=100,retry_delay=300)

count = 100
cursor = tweepy.Cursor(api.search_tweets,
                       q = f'{query}',
                       lang = 'en',
                       result_type = 'recent',
                       count = count)
print("Query Complete")

tweet_payload = []

for tweet in cursor.items(count):
    now = datetime.now()
    current_time = now.strftime("%H:%M:%S")

    current_searches_remaining = api.rate_limit_status()['resources']['search']['/search/tweets']['remaining']
    current_search_limit = api.rate_limit_status()['resources']['search']['/search/tweets']['limit']
    max_searches = current_search_limit * .25
    #print("Checking rate limit")

    if current_searches_remaining >= max_searches:
        print("Searches Remaining: ", current_searches_remaining, "/", current_search_limit)`

When I check the JSON for api.rate_limit_status()['resources'] every single rate limit is always maxed out, even after being rate limited. Thoughts?

@NovemberFalls
Copy link
Author

Another thing I noticed is that I am sharing the same rate limit across all other rate limits. Is this a new thing in 2.0?

@Harmon758
Copy link
Member

There's other reports of this (e.g. https://twittercommunity.com/t/get-application-rate-limit-status-return-wrong-number-of-remaining-calls/175952), and I'm able to reproduce the issue, but this is a Twitter API bug, and it seems like it probably won't be fixed since it's an API v1.1 endpoint.

I'm not sure what you mean by "sharing the same rate limit across all other rate limits".

For code block usage, see https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks.

@Harmon758 Harmon758 added the API This is regarding Twitter's API label Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API This is regarding Twitter's API
Projects
None yet
Development

No branches or pull requests

2 participants