📜  获取项目 dynamodb boto3 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:12.433000             🧑  作者: Mango

代码示例1
def get_movie(title, year, dynamodb=None):
    if not dynamodb:
        dynamodb = boto3.resource('dynamodb', endpoint_url="http://localhost:8000")

    table = dynamodb.Table('Movies')

    try:
        response = table.get_item(Key={'year': year, 'title': title})
    except ClientError as e:
        print(e.response['Error']['Message'])
    else:
        return response['Item']