TwitterGET friends/ids
とGET users/lookup
リソースに電話しています。レート制限を考慮に入れるまで、それらはうまく機能します。作業コードの例を次に示します。
def followers_ids(screen_name)
cursor = "-1"
followers_ids = []
while cursor != 0 do
followers = Twitter.follower_ids(screen_name, :cursor => cursor)
cursor = followers.next_cursor
followers_ids << followers.ids
end
followers_ids.flatten!
followers_ids
end
sleep
次のように while ループにa を投げると:
while cursor != 0 do
followers = Twitter.follower_ids(screen_name, :cursor => cursor)
cursor = followers.next_cursor
followers_ids << followers.ids
sleep(60)
end
さまざまなタイミングでさまざまなエラー セットが発生します。
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:799in 'connect': execution expired (Twitter::Error::ClientError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:799:in 'block in connect'
..
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:73:in 'perform_request'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:38:in 'call'
と
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/twitter-4.6.2/lib/twitter/response/raise_error.rb:21:in 'on_complete': Twitter is down or being upgraded (Twitter::Error:BadGateway)
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/response.rb:9:in 'block in call'
..
何が起こっているのか誰にも分かりますか?眠っているとき、あなたのプログラムはすべてのメッセージを無視するということをどこかで読んだことがあります。これはその一部でしょうか?これを行うことができるより良い方法はありますか?