anaconda icon indicating copy to clipboard operation
anaconda copied to clipboard

EnableThrottling for GetFollowersIdsAll

Open xfreakart opened this issue 7 years ago • 1 comments

Hi,

I'm trying to get all Followers Id's of a "big" account. Twitter limits 5K results per page (pagination) every 15 min. So I tried to set EnableThrottling with:

	api := anaconda.NewTwitterApiWithCredentials(AT, ATS, CK, CS)
	api.EnableThrottling(duration, 1)

When I call GetFollowersIdsAll I though that internally even that is just one query that I'm making it would apply EnableThrottling.

result := api.GetFollowersIdsAll(v)
	for id := range result {
		fmt.Println(id)
	}

It does not. It follows the pagination so when It has to load the second part It gets the error "Rate limit exceded".

returned status 429, {"errors":[{"message":"Rate limit exceeded","code":88}]}}

Was this a misunderstanding of EnableThrottling usage or there is another aproach for this?

Thanks!

xfreakart avatar Jul 05 '18 06:07 xfreakart

As I understand, anaconda has built-in rate limit handling, when you call EnableThrottling you turn that off, as you choose to throttle the requests manually yourself.

From the README:

If you make queries too quickly, you may bump against Twitter's rate limits. If this happens, anaconda automatically retries the query when the rate limit resets, using the X-Rate-Limit-Reset header that Twitter provides to determine how long to wait.

In other words, users of the anaconda library should not need to handle rate limiting errors themselves; this is handled seamlessly behind-the-scenes. If an error is returned by a function, another form of error must have occurred (which can be checked by using the fields provided by the ApiError struct).

rumd3x avatar Jun 05 '20 21:06 rumd3x