简体   繁体   English

Boto3 SES 客户端收到 SignatureDoesNotMatch 错误

[英]Boto3 SES Client gets SignatureDoesNotMatch error

I have the following setup:我有以下设置:

Python Flask API with boto3 installed. Python Flask API 安装了 boto3。 I create a boto3 client like so:我像这样创建一个 boto3 客户端:

client = boto3.client(
    "ses",
    region_name='eu-west-1',
    aws_access_key_id='myAccessKeyID',
    aws_secret_access_key='mySecretAccessKey'
)

Then I try to send an email like so:然后我尝试像这样发送 email:

try:
    client.send_email(
        Source='VerifiedSourceEmail',
        Destination={
            'ToAddresses': ['VerifiedRecipientEmail'],
            'CcAddresses': [],
            'BccAddresses': [],
        },
        Message={
            'Subject': {'Data': 'Test'},
            'Body': {'Text': {'Data': 'Test'},
        }
except ClientError as e:
    return {
        'ErrorCode': e.response['Error']['Code'],
        'ErrorMessage': e.response['Error']['Message'],
    }

When I try to do this, I get:当我尝试这样做时,我得到:

ErrorCode: SignatureDoesNotMatch
ErrorMessage: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

I have used the exact same client creation process when connecting to my S3 bucket:连接到我的 S3 存储桶时,我使用了完全相同的客户端创建过程:

client = boto3.client(
    "s3",
    region_name='eu-west-1',
    aws_access_key_id='myS3AccessKeyID',
    aws_secret_access_key='myS3SecretAccessKey'
)

...and this client works fine, I have tested both gets, uploads and deletes with no errors. ...而且这个客户端工作正常,我已经测试了获取、上传和删除都没有错误。

I have tested sending a mail directly in AWS, this works.我测试过直接在 AWS 中发送邮件,这有效。 What am I doing wrong?我究竟做错了什么?

From this answer :这个答案

The keys to be provided to send Emails are not "SMTP Credentials".用于发送电子邮件的密钥不是“SMTP 证书”。 The keys are instead Global access key which can be retrieved http://docs.amazonwebservices.com/ses/latest/GettingStartedGuide/GetAccessIDs.html .密钥是全局访问密钥,可以检索http://docs.amazonwebservices.com/ses/latest/GettingStartedGuide/GetAccessIDs.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何仅通过 Python 客户端 boto3 使用 AWS 简单 Email 服务 (SES) 验证在 AWS Route 53 中注册的域? - How do I verify a domain registered in AWS Route 53 with AWS Simple Email Service (SES) purely through the Python client, boto3? 如何导入boto3 athena客户端异常 - how to import boto3 athena client exceptions boto3 s3 复制对象错误 - boto3 s3 copyObject error python boto3 s3 客户端过滤子目录和深度 - python boto3 s3 client filter subdirectories and depth 尝试从 AWS Lambda 连接到 Boto3 客户端并接收超时 - Trying to connect to Boto3 Client from AWS Lambda and Receiving Timeout 过滤 Boto3“client.describe_volumes”响应 - Filter Boto3 "client.describe_volumes" response Boto3 S3 客户端方法抛出 NoSuchBucket 即使它有 - Boto3 S3 client methods throw NoSuchBucket even it has Boto3 Glue 客户端缺少 list_schemas() 方法 object - list_schemas() method missing on Boto3 Glue client object 调用 UploadServerCertificate 操作时发生客户端错误(SignatureDoesNotMatch) - A client error (SignatureDoesNotMatch) occurred when calling the UploadServerCertificate operation 尝试使用 boto3 为 EMR 获取实例类型和计数时出错 - Error while trying to get INSTANCETYPE AND COUNT using boto3 for EMR
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM