【发布时间】:2021-06-19 16:33:49
【问题描述】:
我是一名 AWS 新手,正在尝试使用他们的 OCR 服务 Textract API。 据我了解,我需要将文件上传到 S3 存储桶,然后在其上运行 textract。
但是当我运行我的代码时它会出错。
import boto3
import trp
# Document
s3BucketName = "textract-console-us-east-1-057eddde-3f44-45c5-9208-fec27f9f6420"
documentName = "ok0001_prioridade01_x45f3.pdf"
]\[\[""
# Amazon Textract client
textract = boto3.client('textract',region_name="us-east-1",aws_access_key_id="xxxxxx",
aws_secret_access_key="xxxxxxxxx")
# Call Amazon Textract
response = textract.analyze_document(
Document={
'S3Object': {
'Bucket': s3BucketName,
'Name': documentName
}
},
FeatureTypes=["TABLES"])
这是我得到的错误:
botocore.errorfactory.InvalidS3ObjectException: An error occurred (InvalidS3ObjectException) when calling the AnalyzeDocument operation: Unable to get object metadata from S3. Check object key, region and/or access permissions.
我错过了什么?我该如何解决?
【问题讨论】:
标签: amazon-web-services amazon-s3 boto3 amazon-textract