Python SDK

安装

Uni Python SDK 使用 PyPI 托管,可从公共 PyPI 仓库 中获得。

在项目中使用 pip 添加 unisms 作为依赖:

																										
pip install unisms

使用示例

以下示例展示如何使用 Uni Python SDK 快速调用服务。

发送短信

																										
from unisdk . sms import UniSMS from unisdk . exception import UniException # 初始化 client = UniSMS ( "your access key id" , "your access key secret" ) # 若使用简易验签模式仅传入第一个参数即可 try : # 发送短信 res = client . send ( { "to" : "your phone number" , "signature" : "UniSMS" , "templateId" : "login_tmpl" , "templateData" : { "code" : 7777 } } ) print ( res . data ) except UniException as e : print ( e )