If I need to add a word to dynamoDB table, I use the lambda function. The function URL looks like this...
https://z2zsnbwispdo5gh2z544bkblbe0amxfb.lambda-url.us-east-1.on.aws/?धर्मादAnd the code is as follows:
import boto3
import urllib.parse
def lambda_handler(event, context):
request_body = event['rawQueryString']
print (request_body)
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('sanskrit')
key = { 'pk': urllib.parse.unquote(request_body)}
table.put_item( Item=key )
return {
'statusCode': 200,
'body': 'success'
}
It saves the word "धर्माद" to the dynamoDB table "sanskrit".
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.