Created
August 1, 2019 08:22
-
-
Save SumindaD/a76152220f61d004989cfdcfbad6834d 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 | |
import json | |
from boto3.dynamodb.conditions import Key, Attr | |
def lambda_handler(event, context): | |
eventBody = json.loads(json.dumps(event))['body'] | |
searchString = json.loads(eventBody)['Search'] | |
print(searchString) | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table('TextractData') | |
response = table.scan( | |
FilterExpression=Attr('ScannedContent').contains(searchString) | |
) | |
foundResults = '' | |
for i in response['Items']: | |
foundResults += i['UserId'] + ':' + i['FileName'] + ':' + i['ScannedContent'] | |
# TODO implement | |
return { | |
'statusCode': 200, | |
'body': json.dumps(foundResults) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment