2017-02-07 5 views
0

次のコードでは、「レート超過...」エラーが発生しています。Amazon Kinesisでこのコードの「レート超過」エラーが発生する理由

from boto import kinesis 
import time 

kinesis = kinesis.connect_to_region('us-east-1') 
response = kinesis.describe_stream('BenTest') 

if response['StreamDescription']['StreamStatus'] == 'ACTIVE': 
    print '[x] Stream is active' 

    shards = response['StreamDescription']['Shards'] 
    for shard in shards: 
     shard_id = shard['ShardId'] 
     print "[x] Shard ID: %s" % shard_id 

     shard_it = kinesis.get_shard_iterator('BenTest', shard_id, 'LATEST')['ShardIterator'] 
     print "[x] Shard iterator: %s" % shard_it 
while True: 
     out = kinesis.get_records(shard_it, limit=2) 
     shard_it = out["NextShardIterator"] 
      for o in out['Records']: 
       print "[x] %s" % o['Data'] 
       time.sleep(0.5) 

最初のget_recordsコールでエラーが発生しているようです。

私は間違っていますか?

+2

unindent time.sleep(0.5)ワンレベル。あなたはデータが利用できないときに狂ったようにAPIをポーリングします。 – hellomichibye

+0

ありがとう!それはそれを修正! –

+0

答えとして追加しました。あなたはそれを受け入れてくださいますか? – hellomichibye

答えて

1

unindent time.sleep(0.5)1レベル。あなたはデータが利用できないときに狂ったようにAPIをポーリングします。

関連する問題