def write(self,data_str): #try-- check if data_str is a dict req_json_obj = ([{"sender": self.sender.device_name , "receiver": self.receiver.device_name, "command" : self.command,"type":"response","requestId" : self.req_id ,"data": data_str}]) craft = json_crafting.Crafting() craft.input_json_data(req_json_obj)
def write(self,data_str): #try-- check if data_str is a dict data_str['requestId'] = `randint(1, 9999)` req_json_obj = ([{"sender": self.sender.device_name , "receiver": self.receiver.device_name, "command": self.command, "type": "request", "data": self.data_str}]) craft = json_crafting.Crafting() craft.input_json_data(send_json_obj)
def sending_msg(self, widget, data): self.pbar.show() startiter, enditer = self.textbuffer1.get_bounds() msg = self.textbuffer1.get_text(startiter, enditer, include_hidden_chars=True) print msg json_data = [{ 'content': msg, 'date': '27', 'time': '4:30', 'sender': 'ME' }] craft = json_crafting.Crafting() craft.input_json_data(json_data) print json_data
def sending_msg(self, widget, data): self.pbar.show() startiter, enditer = self.textbuffer1.get_bounds() msg = self.textbuffer1.get_text(startiter, enditer, include_hidden_chars=True) print msg message = { "to_number": "9158077350", "from_number": "9764344549", "type": "text", "priority": "normal", "message": msg } craft = json_crafting.Crafting() craft.SEND(message) print message