示例#1
0
 def post(self, *args, **kwargs):
     """ Creates SMS send message commands """
     try:
         bot_id = self.get_argument("bot-id")
         contact_id = self.get_argument("sms-contact")
         text_message = self.get_argument("sms-text")
     except:
         self.render("user/error.html", operation="Send SMS", errors="Missing parameters")
         return
     bot = PhoneBot.by_id(bot_id)
     cmd = {"op": "sms", "phone_number": Contact.by_id(contact_id).phone_number, "message": text_message}
     rcommand = RemoteCommand(phone_bot_id=bot.id, command=json.dumps(cmd).encode("utf-8", "ignore"))
     self.dbsession.add(rcommand)
     self.dbsession.flush()
     self.render("user/smssuccess.html")
示例#2
0
 def post(self, *args, **kwargs):
     ''' Creates SMS send message commands '''
     try:
         bot_id = self.get_argument("bot-id")
         contact_id = self.get_argument("sms-contact")
         text_message = self.get_argument("sms-text")
     except:
         self.render("user/error.html", operation = "Send SMS", errors = "Missing parameters")
         return
     bot = PhoneBot.by_id(bot_id)
     cmd = {
         'op': 'sms', 
         'phone_number': Contact.by_id(contact_id).phone_number,
         'message': text_message,
     }
     rcommand = RemoteCommand(
         phone_bot_id = bot.id,
         command = json.dumps(cmd).encode('utf-8', 'ignore'),
     )
     self.dbsession.add(rcommand)
     self.dbsession.flush()
     self.render("user/smssuccess.html")