Пример #1
0
def send_sms(recipients, context, sms_template='alert'):
    response = False

    if not recipients:
        logger.debug("No recipients for alert")
        return False

    if settings.CLICKATELL_KEY == 'your_clickatell_key' or settings.DEBUG:
        clicksms = False
    else:
        clicksms = Rest(settings.CLICKATELL_KEY)

    # TODO Enhance the Sms template to contain useful inforamation
    sms_template = get_template('seshdash/sms/%s_sms.txt' % sms_template)
    sms = sms_template.render(context)

    if clicksms:
        if not settings.DEBUG:
            response = clicksms.sendMessage(recipients, sms)
            print "The clickatell response is: %s" % response
            response = not response[0]['errorCode']

    return response
Пример #2
0
def send_sms(recipients, context, sms_template='alert'):
    response = False

    if not recipients:
        logger.debug("No recipients for alert")
        return False

    if settings.CLICKATELL_KEY == 'your_clickatell_key' or settings.DEBUG:
        clicksms = False
    else:
        clicksms = Rest(settings.CLICKATELL_KEY)

    # TODO Enhance the Sms template to contain useful inforamation
    sms_template = get_template('seshdash/sms/%s_sms.txt'%sms_template)
    sms = sms_template.render(context)
    
    if clicksms:
        if not settings.DEBUG:
            response = clicksms.sendMessage(recipients, sms)
            print "The clickatell response is: %s" % response
            response = not response[0]['errorCode']
    
    return response
Пример #3
0
def send_sms(message,cook):
  if(settings.SMS and (timezone.now() - cook.last_notify).seconds > 300):
    clickatell = Rest('GRf1iv_FtCiU6tpabzKZsCpJlewGgOaeeftpAE72biY7I.4SbGdio20MPoH_Gz')
    response = clickatell.sendMessage(['+61431744144'],message)
    cook.last_notify = timezone.now()
    cook.save()