Horje
Kinesis Client get_records example Code Example
Kinesis Client get_records example
import boto3
import json
from datetime import datetime
import time

my_stream_name = 'python-stream'

kinesis_client = boto3.client('kinesis', region_name='us-east-1')

response = kinesis_client.describe_stream(StreamName=my_stream_name)

my_shard_id = response['StreamDescription']['Shards'][0]['ShardId']

shard_iterator = kinesis_client.get_shard_iterator(StreamName=my_stream_name,
                                                      ShardId=my_shard_id,
                                                      ShardIteratorType='LATEST')

my_shard_iterator = shard_iterator['ShardIterator']

record_response = kinesis_client.get_records(ShardIterator=my_shard_iterator,
                                              Limit=2)

while 'NextShardIterator' in record_response:
    record_response = kinesis_client.get_records(ShardIterator=record_response['NextShardIterator'],
                                                  Limit=2)

    print record_response

    # wait for 5 seconds
    time.sleep(5)




Python

Related
how to subtract up everything in a list python Code Example how to subtract up everything in a list python Code Example
natural log and log base 10 in python Code Example natural log and log base 10 in python Code Example
how to prevent \textbackslash in LaTeX from Python Code Example how to prevent \textbackslash in LaTeX from Python Code Example
pyspark now Code Example pyspark now Code Example
list of lists to table python Code Example list of lists to table python Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8