Created
June 27, 2014 13:36
-
-
Save robert-b-clarke/02c21ab05b76749f3da8 to your computer and use it in GitHub Desktop.
Publish SNS messages in Python3 using botocore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import botocore.session | |
# establish a session and set credentials | |
sesh = botocore.session.get_session() | |
sesh.set_credentials(access_key='YOUR_KEY', secret_key='YOUR_SECRET') | |
#get SNS service and set endpoint | |
sns = sesh.get_service('sns') | |
endpoint = sns.get_endpoint('eu-west-1') #or another AWS region | |
#set up a Publish call and execute it | |
op = sns.get_operation('Publish') | |
http_response, response_data = op.call(topic_arn='TOPIC_ARN', subject='test', message='hello', endpoint=endpoint) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
am getting this error
AttributeError: 'Session' object has no attribute 'get_service'