Last active
May 22, 2022 06:39
-
-
Save sats17/f0962e30858773e287009f031a16d89f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
dynamo_db_connection = boto3.resource('dynamodb', region_name='us-east-1') | |
anime_table_name = os.environ['anime_table_name'] | |
def lambda_handler(event, context): | |
print("Incoming event ", event) | |
anime_name = str(event["anime_name"]) | |
response = dynamodb_connection.query( | |
TableName=anime_table_name, | |
KeyConditionExpression='anime_name = :anime_name', | |
ExpressionAttributeValues={ | |
':anime_name': {'S': anime_name} | |
} | |
) | |
anime_info = response['Items'][0] | |
print(anime_info) | |
return {"main_character": anime_info["main_character"]["S"]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment