# TODO 阿里云短信验证码服务类，构建类时请传入字符串类型的手机号和验证码
import sys
from typing import List

from alibabacloud_dysmsapi20170525 import models as dysmsapi_20170525_models
from alibabacloud_dysmsapi20170525.client import Client as Dysmsapi20170525Client
from alibabacloud_tea_openapi import models as open_api_models


class Sample(object):
    def __init__(self):
        pass

    @staticmethod
    def create_client(
            access_key_id: str,
            access_key_secret: str
    ) -> Dysmsapi20170525Client:
        """
        使用AK&SK初始化账号Client
        @param access_key_id:
        @param access_key_secret:
        @return: Client
        @throws Exception
        """
        config = open_api_models.Config(
            # TODO 阿里云AccessKey ID,
            access_key_id='',
            # TODO 阿里云AccessKey Secret,
            access_key_secret=''
        )
        # TODO 访问的域名
        config.endpoint = 'dysmsapi.aliyuncs.com'
        return Dysmsapi20170525Client(config)

    @staticmethod
    def main(
            args: List[str], phone_numbers, template_param
    ):
        client = Sample.create_client('accessKeyId', 'accessKeySecret')
        send_sms_request = dysmsapi_20170525_models.SendSmsRequest(
            # TODO phone_numbers='18348421579', 手机号
            phone_numbers=phone_numbers,
            # TODO 系统名称
            sign_name='木青的小小站',
            # TODO 短信模板
            template_code='SMS_213771725',
            # TODO template_param='{"code":"159652"}' 验证码
            template_param=str({"code": template_param})
        )
        # TODO message会告诉我们信息是否发送成功
        return client.send_sms(send_sms_request).body.message


""" # TODO 测试代码
if __name__ == '__main__':
    # 传参并执行代码操作发送验证码
    print(Sample.main(sys.argv[1:], '13410107951', '159652'))
"""

# TODO 阿里云短信验证码服务类，构建类时请传入字符串类型的手机号和验证码
import sys
from typing import List

from alibabacloud_dysmsapi20170525 import models as dysmsapi_20170525_models
from alibabacloud_dysmsapi20170525.client import Client as Dysmsapi20170525Client
from alibabacloud_tea_openapi import models as open_api_models


class Sample(object):
    def __init__(self):
        pass

    @staticmethod
    def create_client(
            access_key_id: str,
            access_key_secret: str
    ) -> Dysmsapi20170525Client:
        """
        使用AK&SK初始化账号Client
        @param access_key_id:
        @param access_key_secret:
        @return: Client
        @throws Exception
        """
        config = open_api_models.Config(
            # TODO 阿里云AccessKey ID,
            access_key_id='',
            # TODO 阿里云AccessKey Secret,
            access_key_secret=''
        )
        # TODO 访问的域名
        config.endpoint = 'dysmsapi.aliyuncs.com'
        return Dysmsapi20170525Client(config)

    @staticmethod
    def main(
            args: List[str], phone_numbers, template_param
    ):
        client = Sample.create_client('accessKeyId', 'accessKeySecret')
        send_sms_request = dysmsapi_20170525_models.SendSmsRequest(
            # TODO phone_numbers='18348421579', 手机号
            phone_numbers=phone_numbers,
            # TODO 系统名称
            sign_name='木青的小小站',
            # TODO 短信模板
            template_code='SMS_213771725',
            # TODO template_param='{"code":"159652"}' 验证码
            template_param=str({"code": template_param})
        )
        # TODO message会告诉我们信息是否发送成功
        return client.send_sms(send_sms_request).body.message


""" # TODO 测试代码
if __name__ == '__main__':
    # 传参并执行代码操作发送验证码
    print(Sample.main(sys.argv[1:], '13410107951', '159652'))
"""

# TODO 阿里云短信验证码服务类，构建类时请传入字符串类型的手机号和验证码 使用AK&SK初始化账号Client         @param access_key_id:         @param access_key_secret:         @return: Client         @throws Exception # TODO 阿里云AccessKey ID, # TODO 阿里云AccessKey Secret, # TODO 访问的域名 # TODO phone_numbers='18348421579', 手机号 # TODO 系统名称 # TODO 短信模板 # TODO template_param='{"code":"159652"}' 验证码 # TODO message会告诉我们信息是否发送成功 # TODO 测试代码 if __name__ == '__main__':     # 传参并执行代码操作发送验证码     print(Sample.main(sys.argv[1:], '13410107951', '159652'))