手机号黑名单管理
更新时间:2023-07-19
新增手机号黑名单
通过以下代码可以新增手机号黑名单
try:
sms_client.create_mobile_black("SignatureBlack", phone="17600000000", sms_type="CommonNotice", signature_id_str="1234)
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)
查询手机号黑名单
通过以下代码可以查询手机号黑名单
try:
response = sms_client.get_mobile_black(phone="17600000000")
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)
删除手机号黑名单
通过以下代码可以删除手机号黑名单
try:
sms_client.delete_mobile_black("17600000000")
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)