• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python sms.SmsSubmit类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中messaging.sms.SmsSubmit的典型用法代码示例。如果您正苦于以下问题:Python SmsSubmit类的具体用法?Python SmsSubmit怎么用?Python SmsSubmit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了SmsSubmit类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_encoding_class

    def test_encoding_class(self):
        number = "+34654123456"
        text = "hey yo"
        expected_0 = "0001000B914356143254F6001006E8721E947F03"
        expected_1 = "0001000B914356143254F6001106E8721E947F03"
        expected_2 = "0001000B914356143254F6001206E8721E947F03"
        expected_3 = "0001000B914356143254F6001306E8721E947F03"

        sms = SmsSubmit(number, text)
        sms.ref = 0x0
        sms.klass = 0

        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected_0)

        sms.klass = 1
        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected_1)

        sms.klass = 2
        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected_2)

        sms.klass = 3
        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected_3)
开发者ID:bewest,项目名称:python-messaging,代码行数:26,代码来源:test_sms.py


示例2: test_encoding_class

    def test_encoding_class(self):
        number = '2b3334363534313233343536'.decode('hex')
        text = "hey yo"
        expected_0 = "0001000B914356143254F6001006E8721E947F03"
        expected_1 = "0001000B914356143254F6001106E8721E947F03"
        expected_2 = "0001000B914356143254F6001206E8721E947F03"
        expected_3 = "0001000B914356143254F6001306E8721E947F03"

        sms = SmsSubmit(number, text)
        sms.ref = 0x0
        sms.klass = 0

        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected_0)

        sms.klass = 1
        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected_1)

        sms.klass = 2
        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected_2)

        sms.klass = 3
        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected_3)
开发者ID:achiang,项目名称:python-messaging,代码行数:26,代码来源:test_sms.py


示例3: to_pdu

    def to_pdu(self, store=False):
        """Returns the PDU representation of this message"""
        sms = SmsSubmit(self.number, self.text)

        sms.csca = self.csca
        sms.request_status = self.status_request

        if store:
            sms.validity = None

        return sms.to_pdu()
开发者ID:achiang,项目名称:wader,代码行数:11,代码来源:sms.py


示例4: test_encoding_request_status

    def test_encoding_request_status(self):
        # tested with pduspy.exe and http://www.rednaxela.net/pdu.php
        number = "+34654123456"
        text = "hey yo"
        expected = "0021000B914356143254F6000006E8721E947F03"

        sms = SmsSubmit(number, text)
        sms.ref = 0x0
        sms.request_status = True

        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected)
开发者ID:bewest,项目名称:python-messaging,代码行数:12,代码来源:test_sms.py


示例5: test_encoding_request_status

    def test_encoding_request_status(self):
        # tested with pduspy.exe and http://www.rednaxela.net/pdu.php
        number = codecs.decode(b'2b3334363534313233343536', 'hex')
        text = "hey yo"
        expected = "0021000B914356143254F6000006E8721E947F03"

        sms = SmsSubmit(number, text)
        sms.ref = 0x0
        sms.request_status = True

        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected)
开发者ID:onlinecity,项目名称:python-messaging,代码行数:12,代码来源:test_sms.py


示例6: test_encoding_8bit_message

    def test_encoding_8bit_message(self):
        number = "01000000000"
        csca = "+44000000000"
        text = "Hi there..."
        expected = "07914400000000F001000B811000000000F000040B48692074686572652E2E2E"

        sms = SmsSubmit(number, text)
        sms.ref = 0x0
        sms.csca = csca
        sms.fmt = 0x04  # 8 bits

        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected)
开发者ID:bewest,项目名称:python-messaging,代码行数:13,代码来源:test_sms.py


示例7: send_sms

    def send_sms(self, msisdn, text):
        sms = SmsSubmit(msisdn, text)
        # NOTE: The use of the Deferred here is a bit wonky
        #       I'm using it like this because it makes adding callbacks
        #       in a for-loop easier since we're potentially sending
        #       SMSs bigger than 160 chars.
        d = Deferred()
        for pdu in sms.to_pdu():
            d.addCallback(self.next("AT+CMGS=%d" % (pdu.length,), expect="> "))
            d.addCallback(self.next("%s%s" % (pdu.pdu, self.CTRL_Z)))

        d.callback([])
        return d
开发者ID:smn,项目名称:txgsm,代码行数:13,代码来源:protocol.py


示例8: send_sms

 def send_sms(self, number, text, callback_index=None):
     if self.mode == 0:
         sms = SmsSubmit(number, text)
         pdu = sms.to_pdu()[0]
         message_list = [("AT+CMGS=%d" % (pdu.length,), 
                          pdu.pdu,
                          callback_index)]
     else:
         message_list = [("AT+CMGS=%s" % (number,), 
                          text,
                          callback_index)]
     
     self._pending.extend(message_list)
     self._write_next()
开发者ID:SEL-Columbia,项目名称:easygsm,代码行数:14,代码来源:serialmodem.py


示例9: pduformat

def pduformat(phonenumber, message):
    """
    Formats SMS using pdu encoding
    :param phonenumber: Phone number to insert in pdu
    :param message: Text message
    :return: pdustring, pdulenght
    """
    sms = SmsSubmit(phonenumber, message)
    pdu = sms.to_pdu()[0]
    pdustring = pdu.pdu
    pdulength = pdu.length
    # debug output
    # print(phonenumber, message)
    # print(pdu.length, pdu.pdu)
    return pdustring, pdulength
开发者ID:paulbsd,项目名称:smsgateway,代码行数:15,代码来源:smsgateway.py


示例10: test_encoding_csca

    def test_encoding_csca(self):
        number = "+34616585119"
        text = "hola"
        csca = "+34646456456"
        expected = "07914346466554F601000B914316565811F9000004E8373B0C"
        expected_len = 17

        sms = SmsSubmit(number, text)
        sms.csca = csca
        sms.ref = 0x0

        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected)
        self.assertEqual(pdu.length, expected_len)
        self.assertEqual(pdu.cnt, 1)
        self.assertEqual(pdu.seq, 1)
开发者ID:bewest,项目名称:python-messaging,代码行数:16,代码来源:test_sms.py


示例11: sendLongMessage

def sendLongMessage(modem, number, message):
    modem.write('AT+CMGF=0\r')
    time.sleep(0.5)
    sms = SmsSubmit(number, message)
    for pdu in sms.to_pdu():
        print('sending')
        strS = 'AT+CMGS=' + str(len(pdu.pdu) / 2 - 1) + '\r\n'
        modem.write(strS)
        time.sleep(0.5)
        modem.write(pdu.pdu + '\r');
        time.sleep(0.5)
        modem.write(chr(26))
        time.sleep(0.5)
        print('done')
    modem.write('AT+CMGF=1\r')
    time.sleep(0.5)
开发者ID:bangcht,项目名称:smsremote,代码行数:16,代码来源:utils.py


示例12: test_encoding_csca

    def test_encoding_csca(self):
        number = codecs.decode(b'2b3334363136353835313139', 'hex').decode()
        text = "hola"
        csca = "+34646456456"
        expected = "07914346466554F601000B914316565811F9000004E8373B0C"
        expected_len = 17

        sms = SmsSubmit(number, text)
        sms.csca = csca
        sms.ref = 0x0

        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected)
        self.assertEqual(pdu.length, expected_len)
        self.assertEqual(pdu.cnt, 1)
        self.assertEqual(pdu.seq, 1)
开发者ID:onlinecity,项目名称:python-messaging,代码行数:16,代码来源:test_sms.py


示例13: send

 def send(self):
     self.pdu = SmsSubmit(self.recipient, self.content)
     for xpdu in self.pdu.to_pdu():
         command = "AT+CMGS=%d\r" % xpdu.length
         self.SendCommand(command, len(str(xpdu.length)) + 14)
         command = "%s\x1a" % xpdu.pdu
         self.SendCommand(command, len(xpdu.pdu) + 20)
         self.logfile.write(str(datetime.now()))
         self.logfile.write("   after send a sms \n")
开发者ID:awangga,项目名称:spy,代码行数:9,代码来源:spong.py


示例14: send

 def send(self):
     self.pdu = SmsSubmit(self.recipient, self.content)
     for xpdu in self.pdu.to_pdu():
         command = "AT+CMGS=%d\r" % xpdu.length
         a = self.SendCommand(command, len(str(xpdu.length)) + 14)
         command = "%s\x1a" % xpdu.pdu
         b = self.SendCommand(command, len(xpdu.pdu) + 20)
         data = str(a) + str(b)
         self.insertSentitem(self.recipient, self.content, data)
     return data
开发者ID:awangga,项目名称:spy,代码行数:10,代码来源:smsweb.py


示例15: test_encoding_multipart_7bit

    def test_encoding_multipart_7bit(self):
        # text encoded with umts-tools
        text = "Or walk with Kings - nor lose the common touch, if neither foes nor loving friends can hurt you, If all men count with you, but none too much; If you can fill the unforgiving minute With sixty seconds' worth of distance run, Yours is the Earth and everything thats in it, And - which is more - you will be a Man, my son"
        number = "655345678"
        expected = [
            "005100098156355476F80000AAA00500038803019E72D03DCC5E83EE693A1AB44CBBCF73500BE47ECB41ECF7BC0CA2A3CBA0F1BBDD7EBB41F4777D8C6681D26690BB9CA6A3CB7290F95D9E83DC6F3988FDB6A7DD6790599E2EBBC973D038EC06A1EB723A28FFAEB340493328CC6683DA653768FCAEBBE9A07B9A8E06E5DF7516485CA783DC6F7719447FBF41EDFA18BD0325CDA0FCBB0E1A87DD",
            "005100098156355476F80000AAA005000388030240E6349B0DA2A3CBA0BADBFC969FD3F6B4FB0C6AA7DD757A19744DD3D1A0791A4FCF83E6E5F1DB4D9E9F40F7B79C8E06BDCD20727A4E0FBBC76590BCEE6681B2EFBA7C0E4ACF41747419540CCBE96850D84D0695ED65799E8E4EBBCF203A3A4C9F83D26E509ACE0205DD64500B7447A7C768507A0E6ABFE565500B947FD741F7349B0D129741",
            "005100098156355476F80000AA14050003880303C2A066D8CD02B5F3A0F9DB0D",
        ]

        sms = SmsSubmit(number, text)
        sms.ref = 0x0
        sms.rand_id = 136
        sms.validity = timedelta(days=4)

        ret = sms.to_pdu()
        cnt = len(ret)
        for i, pdu in enumerate(ret):
            self.assertEqual(pdu.pdu, expected[i])
            self.assertEqual(pdu.seq, i + 1)
            self.assertEqual(pdu.cnt, cnt)
开发者ID:bewest,项目名称:python-messaging,代码行数:21,代码来源:test_sms.py


示例16: send

 def send(self, message):
     # d = self.sendcommand(b"AT+CMGF=1", 10)
     # if d == b"\r\nOK\r\n":
     #    c = 'AT+CMGS="{0}"'.format(self.number).encode('utf-8')
     #    d = self.sendcommand(c, 10)
     #    if d == b"\r\n> ":
     #        message += "\x1a"
     #        d = self.sendcommand(message.encode('utf-8'), 10)
     d = self._sendcommand(b"AT+CMGF=0", 6)
     if d == b"\r\nOK\r\n":
         s = SmsSubmit(self.tonumber, message)
         pdus = s.to_pdu()
         for pdu in pdus:
             c = 'AT+CMGS={0}'.format(pdu.length).encode('utf-8')
             d = self._sendcommand(c, 4)
             if d == b"\r\n> ":
                 data = pdu.pdu[:]
                 data += "\x1a"
                 d = self._sendcommand(data.encode('utf-8'), 10)
             else:
                 self._sendcommand(b'\x1b', 10)
                 self._sendcommand(b'\x1a', 10)
     return d
开发者ID:tcriess,项目名称:meteorolopi,代码行数:23,代码来源:sms.py


示例17: generateSmsSubmitPdu

    def generateSmsSubmitPdu(self):
        smsPdus = []
        smsDelvObj = SmsSubmit(self._address, self._smsText)
        smsDelvObj._set_csca(self._smscAddress)
        print("Encoding Type:", self._encodingType)
        if ( self._encodingType == 0):
            smsDelvObj.dcs = 0x00
        if ( self._encodingType == 8):
            smsDelvObj.dcs = 0x08

        for i in smsDelvObj.to_pdu():
            smsPdus.append(i.pdu)
        return smsPdus
开发者ID:RajatShukla,项目名称:Test,代码行数:13,代码来源:sms_handler.py


示例18: test_encoding_ucs2_message

    def test_encoding_ucs2_message(self):
        number = "+34616585119"
        text = u'あ叶葉'
        csca = '+34646456456'
        expected = "07914346466554F601000B914316565811F9000806304253F68449"

        sms = SmsSubmit(number, text)
        sms.ref = 0x0
        sms.csca = csca

        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected)

        text = u"Русский"
        number = "655345678"
        expected = "001100098156355476F80008AA0E0420044304410441043A04380439"

        sms = SmsSubmit(number, text)
        sms.ref = 0x0
        sms.validity = timedelta(days=4)

        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected)
开发者ID:bewest,项目名称:python-messaging,代码行数:23,代码来源:test_sms.py


示例19: test_encoding_ucs2_message

    def test_encoding_ucs2_message(self):
        number = codecs.decode(b'2b3334363136353835313139', 'hex').decode()
        text = u'あ叶葉'
        csca = '+34646456456'
        expected = "07914346466554F601000B914316565811F9000806304253F68449"

        sms = SmsSubmit(number, text)
        sms.ref = 0x0
        sms.csca = csca

        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected)

        text = u"Русский"
        number = codecs.decode(b'363535333435363738', 'hex').decode()
        expected = "001100098156355476F80008AA0E0420044304410441043A04380439"

        sms = SmsSubmit(number, text)
        sms.ref = 0x0
        sms.validity = timedelta(days=4)

        pdu = sms.to_pdu()[0]
        self.assertEqual(pdu.pdu, expected)
开发者ID:onlinecity,项目名称:python-messaging,代码行数:23,代码来源:test_sms.py


示例20: send

    def send(self):
        self.ser.flushInput()
        self.ser.flushOutput()
        self.pdu = SmsSubmit(self.recipient, self.content)
        for xpdu in self.pdu.to_pdu():
	        self.logfile.write(str(datetime.now()))
	        self.logfile.write('send CMGS\n')
	        command = 'AT+CMGS=%d\r' % xpdu.length
	        self.SendCommand(command,getline=True)
	        self.logfile.write(str(datetime.now()))
	        self.logfile.write('after send 1 CMGS\n')
	        data = self.ser.readall()
	        print data
	        self.logfile.write(str(datetime.now()))
	        self.logfile.write('after send 2 CMGS\n')
	        command = '%s\x1a' % xpdu.pdu
	        self.SendCommand(command,getline=True)
	        self.logfile.write(str(datetime.now()))
	        self.logfile.write('after send 3 CMGS\n')
	        data = self.ser.readall()
	        print data
	        self.logfile.write(str(datetime.now()))
	        self.logfile.write('after send 4 CMGS\n')
开发者ID:awangga,项目名称:spy,代码行数:23,代码来源:smspdu.py



注:本文中的messaging.sms.SmsSubmit类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python messenger.Messenger类代码示例发布时间:2022-05-27
下一篇:
Python models.Message类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap