Shrikant
Shrikant

Reputation: 803

Connecting to SNS in Boto and Python

I am new to boto and python, trying to connect sns. Here is my sample code:

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

I am getting error:

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'

Any help in this regard is greatly appreciated.

Upvotes: 0

Views: 788

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269081

These days, it is recommended that you use boto3 rather than boto (v2). Here's some sample code:

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

See: boto3 documentation

Upvotes: 1

Related Questions