Created
July 27, 2015 19:11
-
-
Save dewski/5d01ba77144c910ace35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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