1

I am facing a strange TooManyRequests error. it is strange because when I use rails console and request for example [list_timeline(40906334)] more than 15 times < 180 times it works without the error.

however, when I do the same thing from the controller it raise the error. I am suspecting that the reason is because of the creation of new client each time since in the console I created it only once and used it several times.

This is the console code:

@twitter_user = Twitter::Client.new(:oauth_token =>'1234567',:oauth_token_secret => '1234567')

@twitter_user.list_timeline(40906994)
@twitter_user.list_timeline(87506074)
@twitter_user.list_timeline(43344574)

This is the server code:

in the user class

def twitter
  if provider == "twitter"
    @twitter ||= Twitter::Client.new(:oauth_token => token, :oauth_token_secret => secret)
  end
end

in the controller for each call

current_user.twitter.list_timeline(params[:list_id])
Abdulaziz Alsubaie
  • 710
  • 2
  • 8
  • 17
  • I am facing the same issue. When I try through console, it works fine and does not displays TooManyRequests exception. But when I try through a script or through controller, I am facing this issue. As you mentioned, even I am re-initializing the Twitter client several times with different client parameters. – srkgupta Oct 13 '13 at 20:15
  • I solved the issue by adding my user name to the query string e.g. twitter.user_timeline("my_Twitter_username", "cnn", count: 200) – Abdulaziz Alsubaie Oct 14 '13 at 19:22

0 Answers0