在Boto和Python中连接到SNS

问题描述 投票:0回答:1

我是boto和python的新手,试图连接sns。这是我的示例代码:

import boto
sns = boto.connect_sns(aws_access_key_id="my access", aws_secret_access_key="mysecret", region_name='us-east-1')

我收到错误:

Traceback (most recent call last):
  File "sns.py", line 5, in <module>
    sns=boto.connect_sns(aws_access_key_id="XXXXXXXX",aws_secret_access_key="XXXXXXX",region_name='us-east-1')
AttributeError: 'module' object has no attribute 'connect_sns'

非常感谢在这方面的任何帮助。

python-2.7 amazon-web-services boto
1个回答
1
投票

这些天,建议您使用boto3而不是boto(v2)。这是一些示例代码:

import boto3
client = boto3.client('sns', region_name='ap-southeast-2')
response = client.list_topics()

见:boto3 documentation

© www.soinside.com 2019 - 2024. All rights reserved.