Ratelimit Error!

Sep 1, 2015 at 10:06 AM
Edited Sep 1, 2015 at 10:15 AM
hi, i need to get friend list of a user by using User.GetFriendIds, but the api can only be used 15 times every 15 min,so i follow the instructions (https://github.com/linvi/tweetinvi/wiki/Rate-Limits) ,and my code is as follows,but i find that the value of queryRateLimits.Remaining isAlways 0,even 15 minutes later ,the api is still unsuccessfully ,my version is Tweetinvi 0.9.9.3, can you help me?
        TweetinviEvents.QueryBeforeExecute += (sender, vargs) =>
            {
                var queryRateLimits = RateLimit.GetQueryRateLimit(vargs.QueryURL);


                // Some methods are not RateLimited. Invoking such a method will result in the queryRateLimits to be null
                if (queryRateLimits != null)
                {
                    if (queryRateLimits.Remaining > 0)
                    {
                        // We have enough resource to execute the query
                        return;
                    }
                    var alternateCredentials=Auth.CreateCredentials("");
                    var twitterQuery = vargs.TwitterQuery;
                    twitterQuery.TwitterCredentials = alternateCredentials;
                }





            };
Sep 1, 2015 at 1:48 PM
Edited Sep 1, 2015 at 1:49 PM
Hi,

Could you share the url that causes the issue. Also please try to get the RateLimit and look at the object.
Let me know what values you find in the RateLimit object.
var rateLimits = RateLimit.GetCurrentCredentialsRateLimits(false);
Cheers,
Linvi
Sep 2, 2015 at 2:30 AM
Hi,
in my test program,my code is very easy. The key question now is that after 15 times ,API 's RateLimit is 0,but 15min later, all RateLimit is reseted,but the API 's Remaining is still0,so if there is a way to reset RateLimit value of Tweetinvi 0.9.9.3 manually and the phenomenon occurs in all APIs in my tests.
my code is as follow:

TweetinviEvents.QueryBeforeExecute += (sender, vargs) =>
            {
                var queryRateLimits = RateLimit.GetQueryRateLimit(vargs.QueryURL);


                // Some methods are not RateLimited. Invoking such a method will result in the queryRateLimits to be null
                if (queryRateLimits != null)
                {
                    if (queryRateLimits.Remaining > 0)
                    {
                        // We have enough resource to execute the query
                        return;
                    }
                    var alternateCredentials=Auth.CreateCredentials("88qDXwH0hBJ4zXCoTcsOxOOla", " 4mciTPRsB0oarrGBFACZCz3MxX7ds9r8m3zi3yfFub29OrhrO3", "3297218736-07ezFF7hy1381LfpZOKVE6LHL72vggswY7fIn0y", "kPFk17IysX3iNKnk8QAgSQZ6SfQHSq0eKV0qzZ8TSHs3t");
                    var twitterQuery = vargs.TwitterQuery;
                    twitterQuery.TwitterCredentials = alternateCredentials;
                }



            };

        int i = 0;
        while (true)
        {
            i++;

           var tweetJson = User.GetFriendIds(id, 2);
           Console.WriteLine(tweetJson.ToString());
            if (i == 15)
                i = 16;
        }
    }
Sep 2, 2015 at 4:46 AM
hi i am sorry , in the morning ,Code is running correctly,I do not know the specific reasons, may be caused by the network,thank you !