[英]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.