Created
April 12, 2023 20:57
-
-
Save brinnaebent/002553ef2f97b9998c48cf2dafe0ee6d to your computer and use it in GitHub Desktop.
This file contains 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 | |
file_obj = event["Records"][0] # get the current event | |
bucketname = str(file_obj["s3"]["bucket"]["name"]) #get bucket name from event | |
filename = str(file_obj["s3"]["object"]["key"]) #get file name from event | |
textract = boto3.client("textract") | |
response = textract.detect_document_text( | |
Document={ | |
"S3Object": { | |
"Bucket": bucketname, | |
"Name": filename, | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment