Ejemplo n.º 1
0
 def _deliver_token(self, token):
     client = Session().client('sns')
     try:
         client.publish(
             PhoneNumber=self.number,
             Message=str(token)
         )
     except Exception as e:
         logger.exception('Error sending token by Amazon SNS: {0}'.format(e))
         raise
Ejemplo n.º 2
0
 def _deliver_token(self, token):
     client = Session(
         aws_access_key_id=getattr(django.conf.settings,
                                   'SNS_AWS_ACCESS_KEY_ID', None),
         aws_secret_access_key=getattr(django.conf.settings,
                                       'SNS_AWS_SECRET_ACCESS_KEY', None),
         aws_session_token=getattr(django.conf.settings,
                                   'SNS_AWS_SESSION_TOKEN', None),
         region_name=getattr(django.conf.settings, 'SNS_REGION_NAME', None),
         botocore_session=getattr(django.conf.settings,
                                  'SNS_BOTOCORE_SESSION', None),
         profile_name=getattr(django.conf.settings, 'SNS_PROFILE_NAME',
                              None)).client('sns')
     try:
         client.publish(PhoneNumber=self.number, Message=str(token))
     except Exception as e:
         logger.exception(
             'Error sending token by Amazon SNS: {0}'.format(e))
         raise