import boto3
AWS_REGION = 'us-west-2'
SNS_TOPIC_ARN = 'arn:aws:sns:us-west-2:123456789012:MyTopic'
DEVICE_TOKEN = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'
sns = boto3.client('sns', region_name=AWS_REGION)
response = sns.publish( TargetArn=SNS_TOPIC_ARN, Message='Hello world!', MessageStructure='json', MessageAttributes={ 'Application': { 'DataType': 'String', 'StringValue': 'MyApp' }, 'Platform': { 'DataType': 'String', 'StringValue': 'APNS' }, 'Token': { 'DataType': 'String', 'StringValue': DEVICE_TOKEN } } )
print(response)