第一次提交:阿龙电竞 Django 后端最新版本
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
# -*- coding: utf8 -*-
|
||||
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
# 访问上下游模块超时。
|
||||
FAILEDOPERATION_ACCESSUPSTREAMTIMEOUT = 'FailedOperation.AccessUpstreamTimeout'
|
||||
|
||||
# 语音内容中含有敏感词,请[联系我们](https://cloud.tencent.com/document/product/1128/37720)沟通解决。
|
||||
FAILEDOPERATION_CONTAINSENSITIVEWORD = 'FailedOperation.ContainSensitiveWord'
|
||||
|
||||
# 后端请求包解析失败,通常由于没有遵守 API 接口说明规范导致的,请参见[1004错误详解](https://cloud.tencent.com/document/product/1128/38004#Q5)。
|
||||
FAILEDOPERATION_FAILRESOLVEPACKET = 'FailedOperation.FailResolvePacket'
|
||||
|
||||
# 套餐包余量不足,请及时[购买语音套餐包](https://buy.cloud.tencent.com/voice)。
|
||||
FAILEDOPERATION_INSUFFICIENTBALANCEINVOICEPACKAGE = 'FailedOperation.InsufficientBalanceInVoicePackage'
|
||||
|
||||
# 无效 JSON,请核查发送的请求是否为标准的 JSON 格式。
|
||||
FAILEDOPERATION_INVALIDJSONPARAMETERS = 'FailedOperation.InvalidJsonParameters'
|
||||
|
||||
# 无效参数,请核查发送的请求参数是否为对应 API 所需参数。
|
||||
FAILEDOPERATION_INVALIDPARAMETERS = 'FailedOperation.InvalidParameters'
|
||||
|
||||
# 解析请求包体时候失败。
|
||||
FAILEDOPERATION_JSONPARSEFAIL = 'FailedOperation.JsonParseFail'
|
||||
|
||||
# 语音未知错误,请[联系我们](https://cloud.tencent.com/document/product/1128/37720)沟通解决。
|
||||
FAILEDOPERATION_PARAMETERSOTHERERROR = 'FailedOperation.ParametersOtherError'
|
||||
|
||||
# 未申请号码或申请的号码资源已过期,请及时支付月功能费用和信息服务费用,具体操作请参见[购买指南](https://cloud.tencent.com/document/product/1128/90745)。
|
||||
FAILEDOPERATION_PHONENUMBERUNAPPLIEDOREXPIRED = 'FailedOperation.PhonenumberUnappliedOrExpired'
|
||||
|
||||
# 模板未审核或请求的内容与审核通过的模板内容不匹配,请参见[1014错误详解](https://cloud.tencent.com/document/product/1128/38004#Q6)
|
||||
FAILEDOPERATION_TEMPLATEINCORRECTORUNAPPROVED = 'FailedOperation.TemplateIncorrectOrUnapproved'
|
||||
|
||||
# 访问上游超时网络,请稍后重试。
|
||||
INTERNALERROR_ACCESSUPSTREAMTIMEOUT = 'InternalError.AccessUpstreamTimeout'
|
||||
|
||||
# 请求发起时间不正常,通常由您的服务器与腾讯云服务器之间的时间差超过10分钟引起。
|
||||
INTERNALERROR_REQUESTTIMEEXCEPTION = 'InternalError.RequestTimeException'
|
||||
|
||||
# 后端不存在该 REST API 接口,请核查 REST API 接口说明。
|
||||
INTERNALERROR_RESTAPIINTERFACENOTEXIST = 'InternalError.RestApiInterfaceNotExist'
|
||||
|
||||
# 后端 Sig 校验失败。
|
||||
INTERNALERROR_SIGVERIFICATIONFAIL = 'InternalError.SigVerificationFail'
|
||||
|
||||
# 内部sso通道超时。
|
||||
INTERNALERROR_SSOSENDRECVFAIL = 'InternalError.SsoSendRecvFail'
|
||||
|
||||
# 语音上游错误,请[联系我们](https://cloud.tencent.com/document/product/1128/37720)沟通解决。
|
||||
INTERNALERROR_UPSTREAMERROR = 'InternalError.UpstreamError'
|
||||
|
||||
# 被叫手机号码格式校验失败。
|
||||
INVALIDPARAMETERVALUE_CALLEDNUMBERVERIFYFAIL = 'InvalidParameterValue.CalledNumberVerifyFail'
|
||||
|
||||
# 语音模板中单个变量长度超过限制,如需调整限制,请[联系我们](https://cloud.tencent.com/document/product/1128/37720)。
|
||||
INVALIDPARAMETERVALUE_CONTENTLENGTHLIMIT = 'InvalidParameterValue.ContentLengthLimit'
|
||||
|
||||
# SDK AppID 不存在。
|
||||
INVALIDPARAMETERVALUE_SDKAPPIDNOTEXIST = 'InvalidParameterValue.SdkAppidNotExist'
|
||||
|
||||
# 下发语音消息时命中频率限制策略,如需申请不受频率限制的测试号码或更改限制策略,请[联系我们](https://cloud.tencent.com/document/product/1128/37720)。
|
||||
LIMITEXCEEDED_DELIVERYFREQUENCYLIMIT = 'LimitExceeded.DeliveryFrequencyLimit'
|
||||
|
||||
# SDK AppID 禁用发送语音消息,如有需要请[联系我们](https://cloud.tencent.com/document/product/1128/37720)。
|
||||
UNAUTHORIZEDOPERATION_SDKAPPIDISDISABLED = 'UnauthorizedOperation.SdkAppidIsDisabled'
|
||||
|
||||
# 因腾讯云账号欠费被停止服务,请及时为您的腾讯云账号[充值](https://cloud.tencent.com/document/product/555/7425)缴清欠款。
|
||||
UNAUTHORIZEDOPERATION_SERVICESUSPENDDUETOARREARS = 'UnauthorizedOperation.ServiceSuspendDueToArrears'
|
||||
|
||||
# VoiceSdkAppid 校验失败。
|
||||
UNAUTHORIZEDOPERATION_VOICESDKAPPIDVERIFYFAIL = 'UnauthorizedOperation.VoiceSdkAppidVerifyFail'
|
||||
|
||||
# 操作不支持。
|
||||
UNSUPPORTEDOPERATION = 'UnsupportedOperation'
|
||||
@@ -0,0 +1,372 @@
|
||||
# -*- coding: utf8 -*-
|
||||
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import warnings
|
||||
|
||||
from tencentcloud.common.abstract_model import AbstractModel
|
||||
|
||||
|
||||
class SendCodeVoiceRequest(AbstractModel):
|
||||
r"""SendCodeVoice请求参数结构体
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
r"""
|
||||
:param _CodeMessage: 验证码,仅支持填写数字,实际播报语音时,会自动在数字前补充语音文本"您的验证码是"。
|
||||
:type CodeMessage: str
|
||||
:param _CalledNumber: 被叫手机号码,采用 e.164 标准,格式为+[国家或地区码][用户号码]。
|
||||
例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号。
|
||||
:type CalledNumber: str
|
||||
:param _VoiceSdkAppid: 在[语音控制台](https://console.cloud.tencent.com/vms)添加应用后生成的实际SdkAppid,示例如1400006666。
|
||||
:type VoiceSdkAppid: str
|
||||
:param _PlayTimes: 播放次数,可选,最多3次,默认2次。
|
||||
:type PlayTimes: int
|
||||
:param _SessionContext: 用户的 session 内容,腾讯 server 回包中会原样返回。
|
||||
:type SessionContext: str
|
||||
"""
|
||||
self._CodeMessage = None
|
||||
self._CalledNumber = None
|
||||
self._VoiceSdkAppid = None
|
||||
self._PlayTimes = None
|
||||
self._SessionContext = None
|
||||
|
||||
@property
|
||||
def CodeMessage(self):
|
||||
r"""验证码,仅支持填写数字,实际播报语音时,会自动在数字前补充语音文本"您的验证码是"。
|
||||
:rtype: str
|
||||
"""
|
||||
return self._CodeMessage
|
||||
|
||||
@CodeMessage.setter
|
||||
def CodeMessage(self, CodeMessage):
|
||||
self._CodeMessage = CodeMessage
|
||||
|
||||
@property
|
||||
def CalledNumber(self):
|
||||
r"""被叫手机号码,采用 e.164 标准,格式为+[国家或地区码][用户号码]。
|
||||
例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号。
|
||||
:rtype: str
|
||||
"""
|
||||
return self._CalledNumber
|
||||
|
||||
@CalledNumber.setter
|
||||
def CalledNumber(self, CalledNumber):
|
||||
self._CalledNumber = CalledNumber
|
||||
|
||||
@property
|
||||
def VoiceSdkAppid(self):
|
||||
r"""在[语音控制台](https://console.cloud.tencent.com/vms)添加应用后生成的实际SdkAppid,示例如1400006666。
|
||||
:rtype: str
|
||||
"""
|
||||
return self._VoiceSdkAppid
|
||||
|
||||
@VoiceSdkAppid.setter
|
||||
def VoiceSdkAppid(self, VoiceSdkAppid):
|
||||
self._VoiceSdkAppid = VoiceSdkAppid
|
||||
|
||||
@property
|
||||
def PlayTimes(self):
|
||||
r"""播放次数,可选,最多3次,默认2次。
|
||||
:rtype: int
|
||||
"""
|
||||
return self._PlayTimes
|
||||
|
||||
@PlayTimes.setter
|
||||
def PlayTimes(self, PlayTimes):
|
||||
self._PlayTimes = PlayTimes
|
||||
|
||||
@property
|
||||
def SessionContext(self):
|
||||
r"""用户的 session 内容,腾讯 server 回包中会原样返回。
|
||||
:rtype: str
|
||||
"""
|
||||
return self._SessionContext
|
||||
|
||||
@SessionContext.setter
|
||||
def SessionContext(self, SessionContext):
|
||||
self._SessionContext = SessionContext
|
||||
|
||||
|
||||
def _deserialize(self, params):
|
||||
self._CodeMessage = params.get("CodeMessage")
|
||||
self._CalledNumber = params.get("CalledNumber")
|
||||
self._VoiceSdkAppid = params.get("VoiceSdkAppid")
|
||||
self._PlayTimes = params.get("PlayTimes")
|
||||
self._SessionContext = params.get("SessionContext")
|
||||
memeber_set = set(params.keys())
|
||||
for name, value in vars(self).items():
|
||||
property_name = name[1:]
|
||||
if property_name in memeber_set:
|
||||
memeber_set.remove(property_name)
|
||||
if len(memeber_set) > 0:
|
||||
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
|
||||
|
||||
|
||||
|
||||
class SendCodeVoiceResponse(AbstractModel):
|
||||
r"""SendCodeVoice返回参数结构体
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
r"""
|
||||
:param _SendStatus: 语音验证码发送状态。
|
||||
:type SendStatus: :class:`tencentcloud.vms.v20200902.models.SendStatus`
|
||||
:param _RequestId: 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
|
||||
:type RequestId: str
|
||||
"""
|
||||
self._SendStatus = None
|
||||
self._RequestId = None
|
||||
|
||||
@property
|
||||
def SendStatus(self):
|
||||
r"""语音验证码发送状态。
|
||||
:rtype: :class:`tencentcloud.vms.v20200902.models.SendStatus`
|
||||
"""
|
||||
return self._SendStatus
|
||||
|
||||
@SendStatus.setter
|
||||
def SendStatus(self, SendStatus):
|
||||
self._SendStatus = SendStatus
|
||||
|
||||
@property
|
||||
def RequestId(self):
|
||||
r"""唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
|
||||
:rtype: str
|
||||
"""
|
||||
return self._RequestId
|
||||
|
||||
@RequestId.setter
|
||||
def RequestId(self, RequestId):
|
||||
self._RequestId = RequestId
|
||||
|
||||
|
||||
def _deserialize(self, params):
|
||||
if params.get("SendStatus") is not None:
|
||||
self._SendStatus = SendStatus()
|
||||
self._SendStatus._deserialize(params.get("SendStatus"))
|
||||
self._RequestId = params.get("RequestId")
|
||||
|
||||
|
||||
class SendStatus(AbstractModel):
|
||||
r"""语音验证码发送状态
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
r"""
|
||||
:param _CallId: 标识本次发送 ID,标识一次下发记录。
|
||||
:type CallId: str
|
||||
:param _SessionContext: 用户的 session 内容,腾讯 server 回包中会原样返回。
|
||||
:type SessionContext: str
|
||||
"""
|
||||
self._CallId = None
|
||||
self._SessionContext = None
|
||||
|
||||
@property
|
||||
def CallId(self):
|
||||
r"""标识本次发送 ID,标识一次下发记录。
|
||||
:rtype: str
|
||||
"""
|
||||
return self._CallId
|
||||
|
||||
@CallId.setter
|
||||
def CallId(self, CallId):
|
||||
self._CallId = CallId
|
||||
|
||||
@property
|
||||
def SessionContext(self):
|
||||
r"""用户的 session 内容,腾讯 server 回包中会原样返回。
|
||||
:rtype: str
|
||||
"""
|
||||
return self._SessionContext
|
||||
|
||||
@SessionContext.setter
|
||||
def SessionContext(self, SessionContext):
|
||||
self._SessionContext = SessionContext
|
||||
|
||||
|
||||
def _deserialize(self, params):
|
||||
self._CallId = params.get("CallId")
|
||||
self._SessionContext = params.get("SessionContext")
|
||||
memeber_set = set(params.keys())
|
||||
for name, value in vars(self).items():
|
||||
property_name = name[1:]
|
||||
if property_name in memeber_set:
|
||||
memeber_set.remove(property_name)
|
||||
if len(memeber_set) > 0:
|
||||
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
|
||||
|
||||
|
||||
|
||||
class SendTtsVoiceRequest(AbstractModel):
|
||||
r"""SendTtsVoice请求参数结构体
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
r"""
|
||||
:param _TemplateId: 模板 ID,在控制台审核通过的模板 ID。
|
||||
:type TemplateId: str
|
||||
:param _CalledNumber: 被叫手机号码,采用 e.164 标准,格式为+[国家或地区码][用户号码]。
|
||||
例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号。
|
||||
:type CalledNumber: str
|
||||
:param _VoiceSdkAppid: 在[语音控制台](https://console.cloud.tencent.com/vms)添加应用后生成的实际SdkAppid,示例如1400006666。
|
||||
:type VoiceSdkAppid: str
|
||||
:param _TemplateParamSet: 模板参数,若模板没有参数,请提供为空数组。
|
||||
注:语音消息的内容长度不超过350字。
|
||||
:type TemplateParamSet: list of str
|
||||
:param _PlayTimes: 播放次数,可选,最多3次,默认2次。
|
||||
:type PlayTimes: int
|
||||
:param _SessionContext: 用户的 session 内容,腾讯 server 回包中会原样返回。
|
||||
:type SessionContext: str
|
||||
"""
|
||||
self._TemplateId = None
|
||||
self._CalledNumber = None
|
||||
self._VoiceSdkAppid = None
|
||||
self._TemplateParamSet = None
|
||||
self._PlayTimes = None
|
||||
self._SessionContext = None
|
||||
|
||||
@property
|
||||
def TemplateId(self):
|
||||
r"""模板 ID,在控制台审核通过的模板 ID。
|
||||
:rtype: str
|
||||
"""
|
||||
return self._TemplateId
|
||||
|
||||
@TemplateId.setter
|
||||
def TemplateId(self, TemplateId):
|
||||
self._TemplateId = TemplateId
|
||||
|
||||
@property
|
||||
def CalledNumber(self):
|
||||
r"""被叫手机号码,采用 e.164 标准,格式为+[国家或地区码][用户号码]。
|
||||
例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号。
|
||||
:rtype: str
|
||||
"""
|
||||
return self._CalledNumber
|
||||
|
||||
@CalledNumber.setter
|
||||
def CalledNumber(self, CalledNumber):
|
||||
self._CalledNumber = CalledNumber
|
||||
|
||||
@property
|
||||
def VoiceSdkAppid(self):
|
||||
r"""在[语音控制台](https://console.cloud.tencent.com/vms)添加应用后生成的实际SdkAppid,示例如1400006666。
|
||||
:rtype: str
|
||||
"""
|
||||
return self._VoiceSdkAppid
|
||||
|
||||
@VoiceSdkAppid.setter
|
||||
def VoiceSdkAppid(self, VoiceSdkAppid):
|
||||
self._VoiceSdkAppid = VoiceSdkAppid
|
||||
|
||||
@property
|
||||
def TemplateParamSet(self):
|
||||
r"""模板参数,若模板没有参数,请提供为空数组。
|
||||
注:语音消息的内容长度不超过350字。
|
||||
:rtype: list of str
|
||||
"""
|
||||
return self._TemplateParamSet
|
||||
|
||||
@TemplateParamSet.setter
|
||||
def TemplateParamSet(self, TemplateParamSet):
|
||||
self._TemplateParamSet = TemplateParamSet
|
||||
|
||||
@property
|
||||
def PlayTimes(self):
|
||||
r"""播放次数,可选,最多3次,默认2次。
|
||||
:rtype: int
|
||||
"""
|
||||
return self._PlayTimes
|
||||
|
||||
@PlayTimes.setter
|
||||
def PlayTimes(self, PlayTimes):
|
||||
self._PlayTimes = PlayTimes
|
||||
|
||||
@property
|
||||
def SessionContext(self):
|
||||
r"""用户的 session 内容,腾讯 server 回包中会原样返回。
|
||||
:rtype: str
|
||||
"""
|
||||
return self._SessionContext
|
||||
|
||||
@SessionContext.setter
|
||||
def SessionContext(self, SessionContext):
|
||||
self._SessionContext = SessionContext
|
||||
|
||||
|
||||
def _deserialize(self, params):
|
||||
self._TemplateId = params.get("TemplateId")
|
||||
self._CalledNumber = params.get("CalledNumber")
|
||||
self._VoiceSdkAppid = params.get("VoiceSdkAppid")
|
||||
self._TemplateParamSet = params.get("TemplateParamSet")
|
||||
self._PlayTimes = params.get("PlayTimes")
|
||||
self._SessionContext = params.get("SessionContext")
|
||||
memeber_set = set(params.keys())
|
||||
for name, value in vars(self).items():
|
||||
property_name = name[1:]
|
||||
if property_name in memeber_set:
|
||||
memeber_set.remove(property_name)
|
||||
if len(memeber_set) > 0:
|
||||
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
|
||||
|
||||
|
||||
|
||||
class SendTtsVoiceResponse(AbstractModel):
|
||||
r"""SendTtsVoice返回参数结构体
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
r"""
|
||||
:param _SendStatus: 语音通知发送状态。
|
||||
:type SendStatus: :class:`tencentcloud.vms.v20200902.models.SendStatus`
|
||||
:param _RequestId: 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
|
||||
:type RequestId: str
|
||||
"""
|
||||
self._SendStatus = None
|
||||
self._RequestId = None
|
||||
|
||||
@property
|
||||
def SendStatus(self):
|
||||
r"""语音通知发送状态。
|
||||
:rtype: :class:`tencentcloud.vms.v20200902.models.SendStatus`
|
||||
"""
|
||||
return self._SendStatus
|
||||
|
||||
@SendStatus.setter
|
||||
def SendStatus(self, SendStatus):
|
||||
self._SendStatus = SendStatus
|
||||
|
||||
@property
|
||||
def RequestId(self):
|
||||
r"""唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
|
||||
:rtype: str
|
||||
"""
|
||||
return self._RequestId
|
||||
|
||||
@RequestId.setter
|
||||
def RequestId(self, RequestId):
|
||||
self._RequestId = RequestId
|
||||
|
||||
|
||||
def _deserialize(self, params):
|
||||
if params.get("SendStatus") is not None:
|
||||
self._SendStatus = SendStatus()
|
||||
self._SendStatus._deserialize(params.get("SendStatus"))
|
||||
self._RequestId = params.get("RequestId")
|
||||
@@ -0,0 +1,72 @@
|
||||
# -*- coding: utf8 -*-
|
||||
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import json
|
||||
|
||||
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
|
||||
from tencentcloud.common.abstract_client import AbstractClient
|
||||
from tencentcloud.vms.v20200902 import models
|
||||
|
||||
|
||||
class VmsClient(AbstractClient):
|
||||
_apiVersion = '2020-09-02'
|
||||
_endpoint = 'vms.tencentcloudapi.com'
|
||||
_service = 'vms'
|
||||
|
||||
|
||||
def SendCodeVoice(self, request):
|
||||
r"""给用户发语音验证码(仅支持数字)。
|
||||
|
||||
:param request: Request instance for SendCodeVoice.
|
||||
:type request: :class:`tencentcloud.vms.v20200902.models.SendCodeVoiceRequest`
|
||||
:rtype: :class:`tencentcloud.vms.v20200902.models.SendCodeVoiceResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("SendCodeVoice", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.SendCodeVoiceResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def SendTtsVoice(self, request):
|
||||
r"""给用户发送指定模板的语音通知。
|
||||
|
||||
:param request: Request instance for SendTtsVoice.
|
||||
:type request: :class:`tencentcloud.vms.v20200902.models.SendTtsVoiceRequest`
|
||||
:rtype: :class:`tencentcloud.vms.v20200902.models.SendTtsVoiceResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("SendTtsVoice", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.SendTtsVoiceResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
@@ -0,0 +1,62 @@
|
||||
# -*- coding: utf8 -*-
|
||||
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
|
||||
from tencentcloud.common.abstract_client_async import AbstractClient
|
||||
from tencentcloud.vms.v20200902 import models
|
||||
from typing import Dict
|
||||
|
||||
|
||||
class VmsClient(AbstractClient):
|
||||
_apiVersion = '2020-09-02'
|
||||
_endpoint = 'vms.tencentcloudapi.com'
|
||||
_service = 'vms'
|
||||
|
||||
async def SendCodeVoice(
|
||||
self,
|
||||
request: models.SendCodeVoiceRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.SendCodeVoiceResponse:
|
||||
"""
|
||||
给用户发语音验证码(仅支持数字)。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "SendCodeVoice"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.SendCodeVoiceResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def SendTtsVoice(
|
||||
self,
|
||||
request: models.SendTtsVoiceRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.SendTtsVoiceResponse:
|
||||
"""
|
||||
给用户发送指定模板的语音通知。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "SendTtsVoice"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.SendTtsVoiceResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
Reference in New Issue
Block a user