def update_incident(): data_str = request.stream.read() decoded = json.loads(data_str) incident_list = parse_incident(decoded) for incident in incident_list: short_msg = parse_short_status(incident) long_msg = parse_long_status(incident) # Email and SMS update to individual subscriber from SMSSender import SMSSender sms_client = SMSSender(short_msg, incident['gps_location']) sms_client.start() #print "SMS content: ", short_msg from EmailSender import EmailSender email_client = EmailSender('*****@*****.**', 'incidents', long_msg, incident['gps_location']) email_client.start() #print "Sent email", long_msg ret = { "success": True } return jsonify(ret)
def send_verification_message(subscription): from SMSSender import SMSSender smsclient = SMSSender("", "") smsclient.send_message(subscription.handphone, "Your verification code is " + subscription.handphone_hash)