def send_sms(self, recipient, text): pdus = gsmpdu.get_outbound_pdus(text, recipient) if len(pdus) > MAX_MESSAGES: raise ValueError("Max_message is %d and text requires %d messages" % (MAX_MESSAGES, len(pdus))) for pdu in pdus: self._send_pdu(pdu)
def send_sms(self, recipient, text, max_messages = 255): """ Method will automatically split long 'text' into multiple SMSs up to max_messages. To enforce only a single SMS, set max_messages=1 Raises 'ValueError' if text will not fit in max_messages """ pdus = gsmpdu.get_outbound_pdus(text, recipient) if len(pdus) > max_messages: raise ValueError( 'Max_message is %d and text requires %d messages' % (max_messages, len(pdus)) ) for pdu in pdus: n = 5 while(n): try: self._send_pdu(pdu) n = 0 except Exception, err: print(err) n -= 1 sleep(3) sleep(3)
def send_sms(self, recipient, text, max_messages=255): """ Method will automatically split long 'text' into multiple SMSs up to max_messages. To enforce only a single SMS, set max_messages=1 Raises 'ValueError' if text will not fit in max_messages """ pdus = gsmpdu.get_outbound_pdus(text, recipient) if len(pdus) > max_messages: raise ValueError( 'Max_message is %d and text requires %d messages' % (max_messages, len(pdus))) for pdu in pdus: n = 5 while (n): try: self._send_pdu(pdu) n = 0 except Exception, err: print(err) n -= 1 sleep(3) sleep(3)
def send_sms(self, recipient, text): pdus = gsmpdu.get_outbound_pdus(text, recipient) if len(pdus) > MAX_MESSAGES: raise ValueError( 'Max_message is %d and text requires %d messages' % (MAX_MESSAGES, len(pdus))) for pdu in pdus: self._send_pdu(pdu)
def send_sms(self, recipient, text, max_messages=255): """ Method will automatically split long 'text' into multiple SMSs up to max_messages. To enforce only a single SMS, set max_messages=1 Raises 'ValueError' if text will not fit in max_messages """ pdus = gsmpdu.get_outbound_pdus(text, recipient) if len(pdus) > max_messages: raise ValueError( 'Max_message is %d and text requires %d messages' % (max_messages, len(pdus))) for pdu in pdus: self._send_pdu(pdu) return True
def send_sms(self, recipient, text, max_messages = 255): """ Method will automatically split long 'text' into multiple SMSs up to max_messages. To enforce only a single SMS, set max_messages=1 Raises 'ValueError' if text will not fit in max_messages """ pdus = gsmpdu.get_outbound_pdus(text, recipient) if len(pdus) > max_messages: raise ValueError( 'Max_message is %d and text requires %d messages' % (max_messages, len(pdus)) ) for pdu in pdus: self._send_pdu(pdu) return True