예제 #1
0
def sendTemplateSMS(to, datas, tempId):
    # 初始化REST SDK
    rest = REST(_serverIP, _serverPort, _softVersion)
    rest.setAccount(_accountSid, _accountToken)
    rest.setAppId(_appId)

    result = rest.sendTemplateSMS(to, datas, tempId)
    print(result)
예제 #2
0
def sendTemplateSMS(to, datas, tempId):
    # 初始化REST SDK
    rest = REST(_serverIP, _serverPort, _softVersion)
    rest.setAccount(_accountSid, _accountToken)
    rest.setAppId(_appId)

    result = rest.sendTemplateSMS(to, datas, tempId)
    for k, v in result.iteritems():

        if k == 'templateSMS':
            for k, s in v.iteritems():
                print('%s:%s' % (k, s))
        else:
            print('%s:%s' % (k, v))
예제 #3
0
def send_template_sms(to, datas, tempId):
    """
    云通讯官方提供的发送短信代码实例
    :param to: 手机号码
    :param datas: 内容数据 格式为列表 例如:['123456', '5'],如不需替换请填 ''
    :param tempId: 模板Id
    :return: 成功、失败
    """
    # 初始化REST SDK
    rest = REST(_serverIP, _serverPort, _softVersion)
    rest.setAccount(_accountSid, _accountToken)
    rest.setAppId(_appId)

    # 调用发送短信的接口函数
    result = rest.sendTemplateSMS(to, datas, tempId)
    print(result)