Answers for "python boto3 exception handling"

0

python boto3 exception handling

import botocore
import boto3
import logging

# Set up our logger
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()

client = boto3.client('kinesis')

try:
    logger.info('Calling DescribeStream API on myDataStream')
    client.describe_stream(StreamName='myDataStream')

except botocore.exceptions.ClientError as error:
    if error.response['Error']['Code'] == 'LimitExceededException':
        logger.warn('API call limit exceeded; backing off and retrying...')
    else:
        raise error
Posted by: Guest on June-28-2021

Code answers related to "python boto3 exception handling"

Python Answers by Framework

Browse Popular Code Answers by Language