示例#1
0
 def send(self, sms):
     """
     prints the given SMS to STDOUT
     """
     logger.log_send(self, sms)
     
     print '-------------\n'+str(sms)+'-------------'
示例#2
0
 def send(self, sms):        
     try:
         self.out_.write(str(sms))
         self.out_.flush()
     except socket.error as e:
         logger.log_error(self, "Error writing to android socket")
     else:
         logger.log_send(self, sms)
示例#3
0
 def send(self, sms):
     """
     Writes the given SMS
     to the socket out. Serialization
     is handled by the __str__ method
     of the SMS object
     """      
     try:
         self.out_.write(str(sms))
         self.out_.flush()
     except socket.error as e:
         logger.log_error(self, "Error writing to android socket")
     else:
         logger.log_send(self, sms)
示例#4
0
 def send(self, sms):
  
     data_dict = {
         'to_number' : sms.to_number,
         'from_number' : sms.from_number,
         'body' : sms.body,
         'key' : self.key
     }
     
     result = requests.post(self.url, data=data_dict)
     if not result.status_code == requests.codes.ok:    
         logger.log_error(self, "error %d - %s posting sms to %s" %
             (result.status_code, result.error, self.url))               
         log_response(result)           
         return False        
     else:
         logger.log_send(self, sms)
         return True
示例#5
0
 def send(self, sms):
     """
     Sends an HTTP POST request to the url specified, with the following parameters,
     to_number, from_number, body, key
     """
     data_dict = {
         'to_number' : sms.to_number,
         'from_number' : sms.from_number,
         'body' : sms.body,
         'key' : self.key
     }
     
     # Make the request
     result = requests.post(self.url, data=data_dict)
     
     if result.status_code == requests.codes.ok:    
         logger.log_send(self, sms)
     else:
         logger.log_error(self, "error %d - %s posting sms to %s" %
             (result.status_code, result.error, self.url))               
         save_error_response(result)           
         return False
示例#6
0
 def send(self, sms):
     """
     prints the given SMS to STDOUT
     """
     logger.log_send(self, sms)
     print sms