User Agent

May 1, 2014 at 3:44 AM
I've been using tweetinvi for search and noticed that my rate limit is less than twitter advertises it to be with application only-authentication. The following link mentions that the absence of a "unique and identifying User Agent string" will reduce the rate limit.

https://dev.twitter.com/docs/rate-limiting/1

Is there currently a way to set the user agent in the search request?
Coordinator
May 1, 2014 at 5:49 PM
Hi,

I am not sure what is causing the issue but I will investigate for you. In the meantime please know that Twitter is now in version 1.1 and the documentation you referenced in for version 1.0.

The agent does not seem to affect the rate limit anymore.

What could happen though is if you are using search and you set the MaximumNumberOfResult parameter > 100.
The reason is that Twitter limit a search result set to 100. Consequently Tweetinvi will execute multiple request so that it returns the number of result you are looking for.

Also, please not that making a MaximumNumberOfResult of 200 does not imply it will result in only 2 queries.
The reason is that Twitter Search API does not always return sets of 100 results event if more than 100 results are available from the API.
Consequently a limit to 200 will result in a minimum of 2 queries but will often result in 3 to 4 queries.

Please let me know if this help.
Linvi
May 2, 2014 at 3:24 AM
From: linvi
Hi,

I am not sure what is causing the issue but I will investigate for you. In the meantime please know that Twitter is now in version 1.1 and the documentation you referenced in for version 1.0.

The agent does not seem to affect the rate limit anymore.

What could happen though is if you are using search and you set the MaximumNumberOfResult parameter > 100.
The reason is that Twitter limit a search result set to 100. Consequently Tweetinvi will execute multiple request so that it returns the number of result you are looking for.

Also, please not that making a MaximumNumberOfResult of 200 does not imply it will result in only 2 queries.
The reason is that Twitter Search API does not always return sets of 100 results event if more than 100 results are available from the API.
Consequently a limit to 200 will result in a minimum of 2 queries but will often result in 3 to 4 queries.

Please let me know if this help.
Linvi
Read the full discussion online.
To add a post to this discussion, reply to this email ([email removed])
To start a new discussion for this project, email [email removed]
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com
Coordinator
May 4, 2014 at 8:12 PM
Hi,

You've just copied my response. Is there any other question I could help you with?

Linvi
May 4, 2014 at 10:21 PM
Not sure why that happened. Here's my original response:


Sorry about the 1 vs 1.1 issue, I should have definitely noticed that.

What you are saying about the MaximumNumberOfResult also makes sense, so thank you for that as well!


Rather than telling you what I think might be happening, I`ll just let you know what I observed and you come to your own conclusion.

I create credentials like this:
var credentials = TwitterCredentials.CreateCredentials(AccessToken, AccessTokenSecret, ConsumerKey, ConsumerSecret);
                TwitterCredentials.ExecuteOperationWithCredentials(credentials, () =>
                {
Then I check the rate limit before doing any queries. i use this code:
ITokenRateLimits rateLimits = RateLimit.GetCurrentCredentialsRateLimits();

rateLimits.SearchTweetsLimit.Remaining
The result returned is 180, although when I check the Twitter Search API Rate limit it is says I should have 450 for application-only auth. Am I using application-only auth with the credential object I created?

I guess I'm not quite sure how that part works.

Thanks,
May 5, 2014 at 7:08 PM
Greetings Linvi,

I am also having the same issue. The rate limit I'm getting back is 180 instead of 450. I'm using ASP.NET MVC 5, .NET 4.5.1.

I set my credentials early on (I'm guessing this is similar to creating the credentials as mentioned by ARS1625 above):
     TwitterCredentials.SetCredentials(accessToken, accessTokenSecret, consumerKey, consumerSecret);
I then store the rate limit on my Model for later reference from the View:
     // Get Rate Limits in Controller
     twitterSearchModel.RateLimits = RateLimit.GetCurrentCredentialsRateLimits();
Later on, I then reference it from my View.
     @Model.RateLimits.SearchTweetsLimit.Limit
I read that for Application-only authentication that you need to be using OAuth 2.0? Do I get 180 because it's using OAuth 1.0A instead?

Thanks for your Help Linvi,
-Paul
Coordinator
May 5, 2014 at 10:08 PM
Hi,

When you set the credentials like this you set the credentials for a specific user which is limited to 180 search requests.
In the current version, Tweetinvi does not allow developers to work directly with ApplicationCredentials instead of UserCredentials.

I will add this feature to be implemented in Tweetinvi 0.9.4.0 but the release won't be coming up before 2 months.
In the meantime I would advise to create 2 credentials and switch from one to another.

Work Item

Linvi
May 6, 2014 at 2:27 AM
Hi Linvi,

Thanks for your quick reply. I have no problem waiting for the new feature to be implemented in a couple of months. I really appreciate that.

I will use your work-around with creating more user credentials, as needed, in the mean time.

Thanks so much for your help,
Kindly,
-Paul