Skip to content

Instantly share code, notes, and snippets.

@yuta-imai
Last active August 29, 2015 14:04
Show Gist options
  • Save yuta-imai/ec6620cd90fac9a2b74b to your computer and use it in GitHub Desktop.
Save yuta-imai/ec6620cd90fac9a2b74b to your computer and use it in GitHub Desktop.
import time
import boto.kinesis
conn = boto.kinesis.connect_to_region('ap-northeast-1')
stream_name = 'YOUR_STREAM_NAME'
stream = conn.describe_stream(stream_name)
shardid = stream['StreamDescription']['Shards'][0]['ShardId']
iterator_object = conn.get_shard_iterator(stream_name,shardid,'LATEST')
iterator = iterator_object['ShardIterator']
while True:
record = conn.get_records(iterator,limit=100,b64_decode=True)
print(record)
iterator = record['NextShardIterator']
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment