Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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)
Comment

PREVIOUS NEXT
Code Example
Python :: what does it mean when i get a permission error in python 
Python :: run python script from bash script 
Python :: pairwise swap in data structure in python 
Python :: featch detail of subscription in stripe api 
Python :: django time cualtulate 
Python :: how to make a square shape in python 
Python :: how to search over a notebook in python 
Python :: how to get a random number between 1 and 10 in python 
Python :: python quick sort 
Python :: python wait for executable to finish before perceeding 
Python :: Herons rule python 
Python :: cannot access modules from neighbouring directories jupyter notebook 
Python :: main.py : invalid syntax 
Python :: if function has no argument python 
Python :: fouier transformation in python open cv 
Python :: how to concatenate all list inside list 
Python :: how to take multiple input python 
Python :: python list safely pop 
Python :: re mobile no validate python 
Python :: ValueError: Could not load "" Reason: "broken data stream when reading image file" 
Python :: python pipe where 
Python :: Minimum Number of Operations to Move All Balls to Each Box in python used in function method 
Python :: using a print function 
Python :: qaction hide show python 
Python :: request.query_dict hubspot 
Python :: pandas series add prefix 
Python :: python open application windows 
Python :: python transpose a list 
Python :: create a pandas dataframe 
Python :: python bytes to hex 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =