1 发送脚本

参考地址 https://v3u.cn/a_id_152

# 短信应用SDK AppID
appid = 你的appid  # SDK AppID是1400开头

# 短信应用SDK AppKey
appkey = "你的appkey"

# 需要发送短信的手机号码
phone_numbers = ["你要发送的手机号"]

# 短信模板ID,需要在短信应用中申请
template_id = 在模板列表里获取  

# 签名
sms_sign = "刘悦的技术博客"

from qcloudsms_py import SmsSingleSender
from qcloudsms_py.httpclient import HTTPError


import ssl
ssl._create_default_https_context = ssl._create_unverified_context

ssender = SmsSingleSender(appid, appkey)
params = ["6666","5"]  # 当模板没有参数时,`params = []`
try:
    result = ssender.send_with_param(86, phone_numbers[0],
        template_id, params, sign=sms_sign, extend="", ext="")  # 签名参数不允许为空串
    print(result)
except HTTPError as e:
    print(e)
except Exception as e:
    print(e)

  

版权声明:本文为zhangshijiezsj原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/zhangshijiezsj/p/13893288.html