Exemple #1
0
    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)
Exemple #2
0
    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)
Exemple #3
0
    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)
Exemple #4
0
    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)
Exemple #5
0
    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
Exemple #6
0
    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