sferik / twitter-ruby

A Ruby interface to the Twitter API.
http://www.rubydoc.info/gems/twitter
MIT License
4.58k stars 1.31k forks source link

Track rate limit when searching tweets #911

Closed dsalahutdinov closed 6 years ago

dsalahutdinov commented 6 years ago

Hi!

Want to track limits while doing search requests to twitter API to looks like this:

search = client.search('some query')
search.each do |tweet|
  # process tweets

  if search.rate_limit.remaining == 0
    # prevent continue to search and wait
  end
end