Twitterのbotを作る #10「Rate Limit exceededエラー」

Twitter-APIにはアクセス上限値というものが、取得情報毎に設けられています。
「Rate limit exceeded」
というエラーが返ってきたら、制限値オーバーです。
仕様について
https://dev.twitter.com/rest/public/rate-limits
このページにAPIの関数別にアクセス上限値が表示されています。
ちなみに、このエラーが出ても数分待てばまた制限値がクリアされているはずです。
*15-minと書かれているから15分毎なのかな?
この制限値を考えると、単純なbotアクセスだと問題ないんですが、問い合わせ頻度などを最小限に抑えるアルゴリズムにしなければいけませんね。
アクセスlimitの引用
Title | Resource family | Requests / 15-min window (user auth) | Requests / 15-min window (app auth) |
---|---|---|---|
GET application/rate_limit_status | application | 180 | 180 |
GET favorites/list | favorites | 15 | 15 |
GET followers/ids | followers | 15 | 15 |
GET followers/list | followers | 15 | 30 |
GET friends/ids | friends | 15 | 15 |
GET friends/list | friends | 15 | 30 |
GET friendships/show | friendships | 180 | 15 |
GET help/configuration | help | 15 | 15 |
GET help/languages | help | 15 | 15 |
GET help/privacy | help | 15 | 15 |
GET help/tos | help | 15 | 15 |
GET lists/list | lists | 15 | 15 |
GET lists/members | lists | 180 | 15 |
GET lists/members/show | lists | 15 | 15 |
GET lists/memberships | lists | 15 | 15 |
GET lists/ownerships | lists | 15 | 15 |
GET lists/show | lists | 15 | 15 |
GET lists/statuses | lists | 180 | 180 |
GET lists/subscribers | lists | 180 | 15 |
GET lists/subscribers/show | lists | 15 | 15 |
GET lists/subscriptions | lists | 15 | 15 |
GET search/tweets | search | 180 | 450 |
GET statuses/lookup | statuses | 180 | 60 |
GET statuses/oembed | statuses | 180 | 180 |
GET statuses/retweeters/ids | statuses | 15 | 60 |
GET statuses/retweets/:id | statuses | 15 | 60 |
GET statuses/show/:id | statuses | 180 | 180 |
GET statuses/user_timeline | statuses | 180 | 300 |
GET trends/available | trends | 15 | 15 |
GET trends/closest | trends | 15 | 15 |
GET trends/place | trends | 15 | 15 |
GET users/lookup | users | 180 | 60 |
GET users/show | users | 180 | 180 |
GET users/suggestions | users | 15 | 15 |
GET users/suggestions/:slug | users | 15 | 15 |
>GET users/suggestions/:slug/members | users | 15 | 15 |