# -*- coding: utf-8 -*- #!/usr/bin/python #encoding=utf-8 import sys from aliyunsdkdysmsapi.request.v20170525 import SendSmsRequest from aliyunsdkdysmsapi.request.v20170525 import QuerySendDetailsRequest from aliyunsdkcore.client import AcsClient import uuid from aliyunsdkcore.profile import region_provider from aliyunsdkcore.http import method_type as MT from aliyunsdkcore.http import format_type as FT import const nowTime='\"2018-04-2\"' addr='\"长沙\"' T="\"后天4-4\"" W="\"晴转多云\"" H="\"25\"" L="\"19\"" FX="\"3级\"" print FX print T #print ${FX} """ 短信业务调用接口示例,版本号:v20170525 Created on 2017-06-12 """ try: reload(sys) sys.setdefaultencoding('utf8') except NameError: pass except Exception as err: raise err # 注意:不要更改 REGION = "cn-hangzhou" PRODUCT_NAME = "Dysmsapi" DOMAIN = "dysmsapi.aliyuncs.com" acs_client = AcsClient(const.ACCESS_KEY_ID, const.ACCESS_KEY_SECRET, REGION) region_provider.add_endpoint(PRODUCT_NAME, REGION, DOMAIN) def send_sms(business_id, phone_numbers, sign_name, template_code, template_param=None): smsRequest = SendSmsRequest.SendSmsRequest() # 申请的短信模板编码,必填 smsRequest.set_TemplateCode(template_code) # 短信模板变量参数 if template_param is not None: smsRequest.set_TemplateParam(template_param) # 设置业务请求流水号,必填。 smsRequest.set_OutId(business_id) # 短信签名 smsRequest.set_SignName(sign_name)
# -*- coding: utf-8 -*- # ACCESS_KEY_ID/ACCESS_KEY_SECRET 根据实际申请的账号信息进行替换 ACCESS_KEY_ID = "LTAI" ACCESS_KEY_SECRET = "WTAQ3ThEwcOsQ0o"