def send_notification_task(to, taskData): logging.basicConfig(filename='SMS.log', level=logging.DEBUG) gateway = AfricasTalkingGateway(settings.username, settings.apikey) message = "New Task Has been created %s " % (taskData) recipients = gateway.sendMessage(to, message) try: for recipient in recipients: logging.info('number=%s;status=%s;messageId=%s;cost=%s' % (recipient['number'], recipient['status'], recipient['messageId'], recipient['cost'])) except AfricasTalkingGatewayException, e: logging.warning('SMS failed to send %s' % str(e))
def sendText(to, code): logging.basicConfig(filename='SMS.log', level=logging.DEBUG) gateway = AfricasTalkingGateway(settings.username, settings.apikey) message = "Welcome to taskwetu, an errand running platform. Your User Code is %s " % (code) recipients = gateway.sendMessage(to, message) try: for recipient in recipients: logging.info('number=%s;status=%s;messageId=%s;cost=%s' % (recipient['number'], recipient['status'], recipient['messageId'], recipient['cost'])) except AfricasTalkingGatewayException, e: logging.warning('Database setup completed %s' % str(e))