Twitter follow api https://api.twitter.com/1.1/friendships/create.json, does't have a hard rate limit but twitter can restrict the user if user follows hundereds of tweeps, when I used client.follow(connection_id) then it stops after following 15 tweeps and throw exception: rate limit exceeded, this should not happen as with testing twitter account I followed only 50 tweeps.
I planned to look closely and inserted some debug 'puts' at various places in the twitter and faraday gem, what I found from debug that before calling twitter follow api client.follow calls twitter friends/ids.json api and this api has rate limit of 15 calls per 15 minutes and thats why client.follow throw rate limit exception after following 15 tweeps, here is debug output
May be I am missing something here, here is my test code
require 'twitter'
class FolowTest
def follow(connection_id, accedd_token, access_token_secret)
client = Twitter::REST::Client.new do |config|
config.consumer_key = 'XXXXXXXXXXXXXX'
config.consumer_secret = 'XXXXXXXXXXXXXX'
config.access_token = 'XXXXXXXXXXXXXXX'
config.access_token_secret = 'XXXXXXXXXXXXXX'
end
client.follow(connection_id)
end
end
Twitter follow api https://api.twitter.com/1.1/friendships/create.json, does't have a hard rate limit but twitter can restrict the user if user follows hundereds of tweeps, when I used client.follow(connection_id) then it stops after following 15 tweeps and throw exception: rate limit exceeded, this should not happen as with testing twitter account I followed only 50 tweeps. I planned to look closely and inserted some debug 'puts' at various places in the twitter and faraday gem, what I found from debug that before calling twitter follow api client.follow calls twitter friends/ids.json api and this api has rate limit of 15 calls per 15 minutes and thats why client.follow throw rate limit exception after following 15 tweeps, here is debug output