Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

import NoSuchKey in boto3

from botocore.exceptions import ClientError

try:
    response = self.client.get_object(Bucket=bucket, Key=key)
    return json.loads(response["Body"].read())
except ClientError as ex:
    if ex.response['Error']['Code'] == 'NoSuchKey':
        logger.info('No object found - returning empty')
        return dict()
    else:
        raise
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #import #NoSuchKey
ADD COMMENT
Topic
Name
4+3 =