【发布时间】:2018-07-02 19:45:01
【问题描述】:
我刚开始使用 AWS Rekognition,遇到了一个我似乎无法解决的问题。
我正在使用Detecting Text in an Image - Amazon Rekognition 上提供的 Python 脚本来测试该服务的工作方式以及我如何将其集成到其他应用程序中。
我知道我为配置和凭据文件输入了正确的数据,可在此处找到:
~/.aws/credentials
因为其他服务(例如 S3)使用命令行代码可以正常工作。在提供的代码中(我将在最后包含它)我指定了正确的存储桶以及我尝试使用的图片的名称。 运行脚本时,在终端上一切正常,直到几秒钟后显示以下错误消息:
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint
URL: "https://rekognition.eu-west-2.amazonaws.com/"
我还尝试了其他几个可用区,例如:
us-east-1, us-west-1, eu-central-1
但它们都会导致相同的错误。
python - botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint - Stack Overflow 已经讨论过类似的问题。但是,该讨论中提供的解决方案并没有解决我遇到的问题。我将不胜感激任何可以解决此问题的帮助和提示。
import boto3
bucket='bucket'
photo='inputtext.jpg'
client=boto3.client('rekognition')
response=client.detect_text(Image={'S3Object':{'Bucket':bucket,'Name':photo}})
textDetections=response['TextDetections']
print response
print 'Matching faces'
for text in textDetections:
print 'Detected text:' + text['DetectedText']
print 'Confidence: ' + "{:.2f}".format(text['Confidence']) + "%"
print 'Id: {}'.format(text['Id'])
if 'ParentId' in text:
print 'Parent Id: {}'.format(text['ParentId'])
print 'Type:' + text['Type']
print
【问题讨论】:
标签: python macos amazon-web-services amazon-rekognition