Skip to content

Instantly share code, notes, and snippets.

@dewski
Created July 27, 2015 19:11
Show Gist options
  • Save dewski/5d01ba77144c910ace35 to your computer and use it in GitHub Desktop.
Save dewski/5d01ba77144c910ace35 to your computer and use it in GitHub Desktop.
require 'twitter'
client = Twitter::REST::Client.new do |config|
config.consumer_key = ""
config.consumer_secret = ""
config.access_token = ""
config.access_token_secret = ""
end
begin
client.friends.each do |friend|
client.friendship_update(friend, retweets: false)
puts "Disabled retweets for #{friend.screen_name}"
end
rescue Twitter::Error::TooManyRequests => error
puts "Retrying in #{error.rate_limit.reset_in + 1}"
sleep error.rate_limit.reset_in + 1
retry
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment