配额频控管理
更新时间:2021-06-25
查询配额频控
通过以下代码可以查看配额和频控详情
try:
response = sms_client.query_quota_rate()
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详情查询配额及频控
变更配额频控
通过以下代码可以变更配额或频控
try:
response = sms_client.update_quota_rate(quota_per_day=100, quota_per_month=100,
rate_limit_per_mobile_per_sign_by_minute=0,
rate_limit_per_mobile_per_sign_by_hour=0,
rate_limit_per_mobile_per_sign_by_day=0)
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详情变更配额或频控