【发布时间】:2019-10-25 18:42:09
【问题描述】:
我正在尝试使用 AWS SNS 将消息发布到移动终端节点,但是有两种类型的消息:促销(默认)和更可靠的交易。
我在设置 SNS 客户端的属性时遇到问题,以便所有消息都是事务性的,以确保将消息传递到手机。如果有人可以帮助我解决这个问题,我将不胜感激。以下是我的代码:
SMSAWSClient = boto3.client(
"sns",
aws_access_key_id="My Key",
aws_secret_access_key="My Secret Key",
region_name="us-east-1"
)
SMSAWSClient.set_sms_attributes(
attributes={
'DefaultSMSType': 'Transactional'
}
)
现在,当我运行程序时,出现以下错误:
“botocore.errorfactory.InvalidParameterException:调用SetSMSAttributes操作时发生错误(InvalidParameter):无效参数:”
这是我用来发布消息的代码:
SMSAWSClient.publish(PhoneNumber="Phone Number",Message="Message Body")
提前致谢。
【问题讨论】:
-
为什么
'DefaultSMSType 'Transactional 之后也有一个杂散空间? -
对不起。我删除了多余的空间,但仍然无法正常工作。
标签: python amazon-web-services aws-sdk boto3 amazon-sns