发送短信
更新时间:2021-07-08
通过以下代码可以发送SMS消息:
try:
response = sms_client.send_message(signature_id='sms-sign-WWejWQ54455', template_id='sms-tmpl-wHoJXL09355',
mobile='13800138000', content_var_dict={'content': "测试发送短信"})
except ex.BceHttpClientError as e:
if isinstance(e.last_error, ex.BceServerError):
LOG.error('send request failed. Response %s, code: %s, request_id: %s'
% (e.last_error.status_code, e.last_error.code, e.last_error.request_id))
else:
LOG.error('send request failed. Unknown exception: %s' % e)
提示: 详细的参数配置及限制条件,可以参考SMS API详情短信下发