コード例 #1
0
ファイル: pdusmshandler.py プロジェクト: rgan/pygsm
    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)
コード例 #2
0
ファイル: pdusmshandler.py プロジェクト: Farhadix/pygsm
    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)
コード例 #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)
コード例 #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)
コード例 #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
コード例 #6
0
ファイル: pdusmshandler.py プロジェクト: albertjan/pygsm
    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