第一次提交:阿龙电竞 Django 后端最新版本
This commit is contained in:
@@ -0,0 +1,214 @@
|
||||
# -*- 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.ams.v20200608 import models
|
||||
|
||||
|
||||
class AmsClient(AbstractClient):
|
||||
_apiVersion = '2020-06-08'
|
||||
_endpoint = 'ams.tencentcloudapi.com'
|
||||
_service = 'ams'
|
||||
|
||||
|
||||
def CancelTask(self, request):
|
||||
r"""取消任务
|
||||
|
||||
:param request: Request instance for CancelTask.
|
||||
:type request: :class:`tencentcloud.ams.v20200608.models.CancelTaskRequest`
|
||||
:rtype: :class:`tencentcloud.ams.v20200608.models.CancelTaskResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("CancelTask", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.CancelTaskResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def CreateAudioModerationTask(self, request):
|
||||
r"""本接口(Audio Moderation)用于提交音频内容(包括音频文件或流地址)进行智能审核任务,使用前请您登陆控制台开通音频内容安全服务。
|
||||
|
||||
### 功能使用说明:
|
||||
- 前往“内容安全控制台-音频内容安全”开启使用音频内容安全服务,首次开通可获得20小时免费调用时长
|
||||
|
||||
### 接口功能说明:
|
||||
- 支持对音频流或音频文件进行检测,判断其中是否包含违规内容;
|
||||
- 支持设置回调地址 Callback 获取检测结果,或通过接口(查询音频检测结果)主动轮询获取检测结果;
|
||||
- 支持识别违规内容,包括:低俗、谩骂、色情、涉政、广告等场景;
|
||||
- 支持批量提交检测任务。检测任务列表最多支持10个;
|
||||
|
||||
### 音频文件调用说明:
|
||||
- 音频文件大小支持:文件 < 500M;
|
||||
- 音频文件时长支持:< 1小时;
|
||||
- 音频码率类型支持:128 Kbps - 256 Kbps ;
|
||||
- 音频文件支持格式:wav、mp3、aac、flac、amr、3gp、 m4a、wma、ogg、ape;
|
||||
- 支持音视频文件分离并对音频文件进行独立识别;
|
||||
|
||||
### 音频流调用说明:
|
||||
- 音频流时长支持:< 3小时;
|
||||
- 音频码率类型支持:128 Kbps - 256 Kbps ;
|
||||
- 音频流支持的传输协议:RTMP、HTTP、HTTPS;
|
||||
- 音频流格式支持的类型:rtp、srtp、rtmp、rtmps、mmsh、 mmst、hls、http、tcp、https、m3u8;
|
||||
- 支持音视频流分离并对音频流进行独立识别;
|
||||
|
||||
:param request: Request instance for CreateAudioModerationTask.
|
||||
:type request: :class:`tencentcloud.ams.v20200608.models.CreateAudioModerationTaskRequest`
|
||||
:rtype: :class:`tencentcloud.ams.v20200608.models.CreateAudioModerationTaskResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("CreateAudioModerationTask", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.CreateAudioModerationTaskResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def CreateBizConfig(self, request):
|
||||
r"""创建业务配置,1个账号最多可以创建20个配置,可定义音频审核的场景,如色情、谩骂等,
|
||||
|
||||
在创建业务配置之前,你需要以下步骤:
|
||||
1. 开通COS存储桶功能,新建存储桶,例如 cms_segments,用来存储 视频转换过程中生成对音频和图片。
|
||||
2. 然后在COS控制台,授权天御内容安全主账号 对 cms_segments 存储桶对读写权限。具体授权操作,参考https://cloud.tencent.com/document/product/436/38648
|
||||
|
||||
:param request: Request instance for CreateBizConfig.
|
||||
:type request: :class:`tencentcloud.ams.v20200608.models.CreateBizConfigRequest`
|
||||
:rtype: :class:`tencentcloud.ams.v20200608.models.CreateBizConfigResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("CreateBizConfig", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.CreateBizConfigResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeAmsList(self, request):
|
||||
r"""音频审核明细列表
|
||||
|
||||
:param request: Request instance for DescribeAmsList.
|
||||
:type request: :class:`tencentcloud.ams.v20200608.models.DescribeAmsListRequest`
|
||||
:rtype: :class:`tencentcloud.ams.v20200608.models.DescribeAmsListResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeAmsList", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeAmsListResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeAudioStat(self, request):
|
||||
r"""控制台识别统计
|
||||
|
||||
:param request: Request instance for DescribeAudioStat.
|
||||
:type request: :class:`tencentcloud.ams.v20200608.models.DescribeAudioStatRequest`
|
||||
:rtype: :class:`tencentcloud.ams.v20200608.models.DescribeAudioStatResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeAudioStat", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeAudioStatResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeBizConfig(self, request):
|
||||
r"""查看单个配置
|
||||
|
||||
:param request: Request instance for DescribeBizConfig.
|
||||
:type request: :class:`tencentcloud.ams.v20200608.models.DescribeBizConfigRequest`
|
||||
:rtype: :class:`tencentcloud.ams.v20200608.models.DescribeBizConfigResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeBizConfig", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeBizConfigResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeTaskDetail(self, request):
|
||||
r"""查看任务详情
|
||||
|
||||
:param request: Request instance for DescribeTaskDetail.
|
||||
:type request: :class:`tencentcloud.ams.v20200608.models.DescribeTaskDetailRequest`
|
||||
:rtype: :class:`tencentcloud.ams.v20200608.models.DescribeTaskDetailResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeTaskDetail", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeTaskDetailResponse()
|
||||
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,179 @@
|
||||
# -*- 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.ams.v20200608 import models
|
||||
from typing import Dict
|
||||
|
||||
|
||||
class AmsClient(AbstractClient):
|
||||
_apiVersion = '2020-06-08'
|
||||
_endpoint = 'ams.tencentcloudapi.com'
|
||||
_service = 'ams'
|
||||
|
||||
async def CancelTask(
|
||||
self,
|
||||
request: models.CancelTaskRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.CancelTaskResponse:
|
||||
"""
|
||||
取消任务
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "CancelTask"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.CancelTaskResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def CreateAudioModerationTask(
|
||||
self,
|
||||
request: models.CreateAudioModerationTaskRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.CreateAudioModerationTaskResponse:
|
||||
"""
|
||||
本接口(Audio Moderation)用于提交音频内容(包括音频文件或流地址)进行智能审核任务,使用前请您登陆控制台开通音频内容安全服务。
|
||||
|
||||
### 功能使用说明:
|
||||
- 前往“内容安全控制台-音频内容安全”开启使用音频内容安全服务,首次开通可获得20小时免费调用时长
|
||||
|
||||
### 接口功能说明:
|
||||
- 支持对音频流或音频文件进行检测,判断其中是否包含违规内容;
|
||||
- 支持设置回调地址 Callback 获取检测结果,或通过接口(查询音频检测结果)主动轮询获取检测结果;
|
||||
- 支持识别违规内容,包括:低俗、谩骂、色情、涉政、广告等场景;
|
||||
- 支持批量提交检测任务。检测任务列表最多支持10个;
|
||||
|
||||
### 音频文件调用说明:
|
||||
- 音频文件大小支持:文件 < 500M;
|
||||
- 音频文件时长支持:< 1小时;
|
||||
- 音频码率类型支持:128 Kbps - 256 Kbps ;
|
||||
- 音频文件支持格式:wav、mp3、aac、flac、amr、3gp、 m4a、wma、ogg、ape;
|
||||
- 支持音视频文件分离并对音频文件进行独立识别;
|
||||
|
||||
### 音频流调用说明:
|
||||
- 音频流时长支持:< 3小时;
|
||||
- 音频码率类型支持:128 Kbps - 256 Kbps ;
|
||||
- 音频流支持的传输协议:RTMP、HTTP、HTTPS;
|
||||
- 音频流格式支持的类型:rtp、srtp、rtmp、rtmps、mmsh、 mmst、hls、http、tcp、https、m3u8;
|
||||
- 支持音视频流分离并对音频流进行独立识别;
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "CreateAudioModerationTask"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.CreateAudioModerationTaskResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def CreateBizConfig(
|
||||
self,
|
||||
request: models.CreateBizConfigRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.CreateBizConfigResponse:
|
||||
"""
|
||||
创建业务配置,1个账号最多可以创建20个配置,可定义音频审核的场景,如色情、谩骂等,
|
||||
|
||||
在创建业务配置之前,你需要以下步骤:
|
||||
1. 开通COS存储桶功能,新建存储桶,例如 cms_segments,用来存储 视频转换过程中生成对音频和图片。
|
||||
2. 然后在COS控制台,授权天御内容安全主账号 对 cms_segments 存储桶对读写权限。具体授权操作,参考https://cloud.tencent.com/document/product/436/38648
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "CreateBizConfig"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.CreateBizConfigResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeAmsList(
|
||||
self,
|
||||
request: models.DescribeAmsListRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeAmsListResponse:
|
||||
"""
|
||||
音频审核明细列表
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeAmsList"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeAmsListResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeAudioStat(
|
||||
self,
|
||||
request: models.DescribeAudioStatRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeAudioStatResponse:
|
||||
"""
|
||||
控制台识别统计
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeAudioStat"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeAudioStatResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeBizConfig(
|
||||
self,
|
||||
request: models.DescribeBizConfigRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeBizConfigResponse:
|
||||
"""
|
||||
查看单个配置
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeBizConfig"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeBizConfigResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeTaskDetail(
|
||||
self,
|
||||
request: models.DescribeTaskDetailRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeTaskDetailResponse:
|
||||
"""
|
||||
查看任务详情
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeTaskDetail"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeTaskDetailResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
@@ -0,0 +1,66 @@
|
||||
# -*- 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.
|
||||
|
||||
|
||||
# DryRun 操作,代表请求将会是成功的,只是多传了 DryRun 参数。
|
||||
DRYRUNOPERATION = 'DryRunOperation'
|
||||
|
||||
# 操作失败。
|
||||
FAILEDOPERATION = 'FailedOperation'
|
||||
|
||||
# 内部错误。
|
||||
INTERNALERROR = 'InternalError'
|
||||
|
||||
# 参数错误。
|
||||
INVALIDPARAMETER = 'InvalidParameter'
|
||||
|
||||
# 参数取值错误。
|
||||
INVALIDPARAMETERVALUE = 'InvalidParameterValue'
|
||||
|
||||
# 超过配额限制。
|
||||
LIMITEXCEEDED = 'LimitExceeded'
|
||||
|
||||
# 缺少参数错误。
|
||||
MISSINGPARAMETER = 'MissingParameter'
|
||||
|
||||
# 操作被拒绝。
|
||||
OPERATIONDENIED = 'OperationDenied'
|
||||
|
||||
# 请求的次数超过了频率限制。
|
||||
REQUESTLIMITEXCEEDED = 'RequestLimitExceeded'
|
||||
|
||||
# 资源被占用。
|
||||
RESOURCEINUSE = 'ResourceInUse'
|
||||
|
||||
# 资源不足。
|
||||
RESOURCEINSUFFICIENT = 'ResourceInsufficient'
|
||||
|
||||
# 资源不存在。
|
||||
RESOURCENOTFOUND = 'ResourceNotFound'
|
||||
|
||||
# 资源不可用。
|
||||
RESOURCEUNAVAILABLE = 'ResourceUnavailable'
|
||||
|
||||
# 资源售罄。
|
||||
RESOURCESSOLDOUT = 'ResourcesSoldOut'
|
||||
|
||||
# 未授权操作。
|
||||
UNAUTHORIZEDOPERATION = 'UnauthorizedOperation'
|
||||
|
||||
# 未知参数错误。
|
||||
UNKNOWNPARAMETER = 'UnknownParameter'
|
||||
|
||||
# 操作不支持。
|
||||
UNSUPPORTEDOPERATION = 'UnsupportedOperation'
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,194 @@
|
||||
# -*- 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.ams.v20201229 import models
|
||||
|
||||
|
||||
class AmsClient(AbstractClient):
|
||||
_apiVersion = '2020-12-29'
|
||||
_endpoint = 'ams.tencentcloudapi.com'
|
||||
_service = 'ams'
|
||||
|
||||
|
||||
def CancelTask(self, request):
|
||||
r"""可使用该接口取消审核任务。请求成功后,接口返回RequestId则说明取消成功。<br>默认接口请求频率限制:**20次/秒**。
|
||||
|
||||
:param request: Request instance for CancelTask.
|
||||
:type request: :class:`tencentcloud.ams.v20201229.models.CancelTaskRequest`
|
||||
:rtype: :class:`tencentcloud.ams.v20201229.models.CancelTaskResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("CancelTask", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.CancelTaskResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def CreateAudioModerationSyncTask(self, request):
|
||||
r"""本接口(CreateAudioModerationSyncTask) 用于提交短音频内容进行智能审核任务,使用前请您使用腾讯云主账号登录控制台 [开通音频内容安全服务](https://console.cloud.tencent.com/cms/audio/package) 并调整好对应的业务配置。
|
||||
|
||||
### 接口使用说明:
|
||||
- 前往“[内容安全控制台-图片内容安全](https://console.cloud.tencent.com/cms/audio/package)”开启使用音频内容安全服务,首次开通服务的用户可免费领用试用套餐包,包含**10小时**免费调用时长,有效期为1个月。
|
||||
- 该接口为收费接口,计费方式敬请参见 [腾讯云音频内容安全定价](https://cloud.tencent.com/product/ams/pricing)。
|
||||
|
||||
### 接口调用说明:
|
||||
- 音频文件大小支持:**文件 <= 4M**;
|
||||
- 音频文件**时长不超过60s**,超过60s音频调用则报错;
|
||||
- 音频文件支持格式:**wav (PCM编码)** 、**mp3**、**aac**、**m4a** (采样率:16kHz~48kHz,位深:16bit 小端,声道数:单声道/双声道,建议格式:**16kHz/16bit/单声道**);
|
||||
- 接口仅限音频文件传入,视频文件传入请调用长音频异步接口;
|
||||
- 接口**默认QPS为20**,如需自定义配置并发或请求频率,请工单咨询;
|
||||
- 接口**默认超时为10s**,请求如超过该时长则接口会报错。
|
||||
|
||||
:param request: Request instance for CreateAudioModerationSyncTask.
|
||||
:type request: :class:`tencentcloud.ams.v20201229.models.CreateAudioModerationSyncTaskRequest`
|
||||
:rtype: :class:`tencentcloud.ams.v20201229.models.CreateAudioModerationSyncTaskResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("CreateAudioModerationSyncTask", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.CreateAudioModerationSyncTaskResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def CreateAudioModerationTask(self, request):
|
||||
r"""本接口(Audio Moderation)用于提交音频内容(包括音频文件或流地址)进行智能审核任务,使用前请您使用腾讯云主账号登录控制台[开通音频内容安全服务](https://console.cloud.tencent.com/cms)并调整好对应的业务配置。<br>
|
||||
|
||||
### 功能使用说明:
|
||||
- 前往“[内容安全控制台-音频内容安全](https://console.cloud.tencent.com/cms)”开启使用音频内容安全服务,首次开通可获得**10小时**免费调用时长,有效期为1个月。
|
||||
|
||||
### 审核并发限制说明:
|
||||
|
||||
- **点播音频(异步审核)**
|
||||
- 默认并发路数:10
|
||||
- 队列处理机制:
|
||||
- 当并发任务达到上限时,新任务进入队列等待处理;
|
||||
- 新送审任务优先处理,旧任务往后排;
|
||||
- **直播音频(异步审核)**
|
||||
- 默认并发路数:100
|
||||
- 队列处理机制:
|
||||
- 运行中的审核任务达到上限时,新请求会提示超频错误:`RequestLimitExceeded`,错误详细为:`You have reached the concurrency limit`;
|
||||
- 不支持排队;
|
||||
|
||||
### 接口功能说明:
|
||||
- 支持对音频流或音频文件进行检测,判断其中是否包含违规内容;
|
||||
- 支持设置回调地址 Callback 获取检测结果(对于已在审核的任务,最长回调时间为用户配置的**切片时长 + 2s**),或通过接口(查询音频检测结果)主动轮询获取检测结果;
|
||||
- 支持识别违规内容,包括:低俗、谩骂、色情、广告等场景;
|
||||
- 支持批量提交检测任务,检测任务列表**最多支持10个**。
|
||||
|
||||
### 音频文件流调用说明:
|
||||
- 音频文件大小支持:**文件 < 500M**;
|
||||
- 音频文件时长支持:**< 1小时**;
|
||||
- 音频码率类型支持:128 Kbps - 256 Kbps ;
|
||||
- 音频文件支持格式:wav、mp3、aac、flac、amr、3gp、 m4a、wma、ogg、ape;
|
||||
- (**当输入为视频文件时**)支持分离视频文件音轨,并对音频内容进行独立审核。
|
||||
|
||||
### 直播音频流调用说明:
|
||||
- 音频流时长支持:**24小时以内**,超过需要重新推送审核任务;
|
||||
- 音频码率类型支持:128 Kbps - 256 Kbps ;
|
||||
- 音频流支持的传输协议:RTMP、HTTP、HTTPS;
|
||||
- 音频流格式支持的类型:rtp、srtp、rtmp、rtmps、mmsh、 mmst、hls、http、tcp、https、m3u8;
|
||||
- (**当输入为视频流时**)支持提取视频流音轨,并对音频内容进行独立审核。
|
||||
|
||||
### 直播断流处理说明:
|
||||
- 请确认已对接[取消任务](https://cloud.tencent.com/document/product/1219/53258)。
|
||||
- 如果直播任务取消/结束,则终止直播拉流并退出审核。
|
||||
- 在直播任务未取消或结束的情况下,若推流中断(例如 `Operation not permitted` 错误),审核服务将在 10分钟内持续尝试重新拉流。检测到有效的图片或音频数据,审核将自动恢复正常;否则,10分钟后终止拉流并退出审核。此时如有需要,请重新提交审核请求。对于因网络问题导致的拉流失败(如 `HTTP 404 Not Found` 错误),系统将进行最多 16次重试。若成功获取有效数据,审核流程即刻恢复;若所有重试均失败,则同样终止拉流并退出审核,需用户重新送审。
|
||||
|
||||
:param request: Request instance for CreateAudioModerationTask.
|
||||
:type request: :class:`tencentcloud.ams.v20201229.models.CreateAudioModerationTaskRequest`
|
||||
:rtype: :class:`tencentcloud.ams.v20201229.models.CreateAudioModerationTaskResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("CreateAudioModerationTask", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.CreateAudioModerationTaskResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeTaskDetail(self, request):
|
||||
r"""通过该接口可查看音频审核任务的详情信息,包括任务状态、检测结果、音频文件识别出的对应文本内容、检测结果所对应的恶意标签及推荐的后续操作等,具体输出内容可查看输出参数示例。
|
||||
|
||||
:param request: Request instance for DescribeTaskDetail.
|
||||
:type request: :class:`tencentcloud.ams.v20201229.models.DescribeTaskDetailRequest`
|
||||
:rtype: :class:`tencentcloud.ams.v20201229.models.DescribeTaskDetailResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeTaskDetail", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeTaskDetailResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeTasks(self, request):
|
||||
r"""通过该接口可查看审核任务列表;您也可根据多种业务信息(业务类型、审核结果、任务状态等)筛选审核任务列表。任务列表输出内容包括当前查询的任务总量、任务名称、任务状态、音频审核类型、基于检测结果的恶意标签及其后续操作等,具体输出内容可查看输出参数示例。<br>默认接口请求频率限制:**20次/秒**。
|
||||
|
||||
:param request: Request instance for DescribeTasks.
|
||||
:type request: :class:`tencentcloud.ams.v20201229.models.DescribeTasksRequest`
|
||||
:rtype: :class:`tencentcloud.ams.v20201229.models.DescribeTasksResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeTasks", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeTasksResponse()
|
||||
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,169 @@
|
||||
# -*- 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.ams.v20201229 import models
|
||||
from typing import Dict
|
||||
|
||||
|
||||
class AmsClient(AbstractClient):
|
||||
_apiVersion = '2020-12-29'
|
||||
_endpoint = 'ams.tencentcloudapi.com'
|
||||
_service = 'ams'
|
||||
|
||||
async def CancelTask(
|
||||
self,
|
||||
request: models.CancelTaskRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.CancelTaskResponse:
|
||||
"""
|
||||
可使用该接口取消审核任务。请求成功后,接口返回RequestId则说明取消成功。<br>默认接口请求频率限制:**20次/秒**。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "CancelTask"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.CancelTaskResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def CreateAudioModerationSyncTask(
|
||||
self,
|
||||
request: models.CreateAudioModerationSyncTaskRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.CreateAudioModerationSyncTaskResponse:
|
||||
"""
|
||||
本接口(CreateAudioModerationSyncTask) 用于提交短音频内容进行智能审核任务,使用前请您使用腾讯云主账号登录控制台 [开通音频内容安全服务](https://console.cloud.tencent.com/cms/audio/package) 并调整好对应的业务配置。
|
||||
|
||||
### 接口使用说明:
|
||||
- 前往“[内容安全控制台-图片内容安全](https://console.cloud.tencent.com/cms/audio/package)”开启使用音频内容安全服务,首次开通服务的用户可免费领用试用套餐包,包含**10小时**免费调用时长,有效期为1个月。
|
||||
- 该接口为收费接口,计费方式敬请参见 [腾讯云音频内容安全定价](https://cloud.tencent.com/product/ams/pricing)。
|
||||
|
||||
### 接口调用说明:
|
||||
- 音频文件大小支持:**文件 <= 4M**;
|
||||
- 音频文件**时长不超过60s**,超过60s音频调用则报错;
|
||||
- 音频文件支持格式:**wav (PCM编码)** 、**mp3**、**aac**、**m4a** (采样率:16kHz~48kHz,位深:16bit 小端,声道数:单声道/双声道,建议格式:**16kHz/16bit/单声道**);
|
||||
- 接口仅限音频文件传入,视频文件传入请调用长音频异步接口;
|
||||
- 接口**默认QPS为20**,如需自定义配置并发或请求频率,请工单咨询;
|
||||
- 接口**默认超时为10s**,请求如超过该时长则接口会报错。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "CreateAudioModerationSyncTask"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.CreateAudioModerationSyncTaskResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def CreateAudioModerationTask(
|
||||
self,
|
||||
request: models.CreateAudioModerationTaskRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.CreateAudioModerationTaskResponse:
|
||||
"""
|
||||
本接口(Audio Moderation)用于提交音频内容(包括音频文件或流地址)进行智能审核任务,使用前请您使用腾讯云主账号登录控制台[开通音频内容安全服务](https://console.cloud.tencent.com/cms)并调整好对应的业务配置。<br>
|
||||
|
||||
### 功能使用说明:
|
||||
- 前往“[内容安全控制台-音频内容安全](https://console.cloud.tencent.com/cms)”开启使用音频内容安全服务,首次开通可获得**10小时**免费调用时长,有效期为1个月。
|
||||
|
||||
### 审核并发限制说明:
|
||||
|
||||
- **点播音频(异步审核)**
|
||||
- 默认并发路数:10
|
||||
- 队列处理机制:
|
||||
- 当并发任务达到上限时,新任务进入队列等待处理;
|
||||
- 新送审任务优先处理,旧任务往后排;
|
||||
- **直播音频(异步审核)**
|
||||
- 默认并发路数:100
|
||||
- 队列处理机制:
|
||||
- 运行中的审核任务达到上限时,新请求会提示超频错误:`RequestLimitExceeded`,错误详细为:`You have reached the concurrency limit`;
|
||||
- 不支持排队;
|
||||
|
||||
### 接口功能说明:
|
||||
- 支持对音频流或音频文件进行检测,判断其中是否包含违规内容;
|
||||
- 支持设置回调地址 Callback 获取检测结果(对于已在审核的任务,最长回调时间为用户配置的**切片时长 + 2s**),或通过接口(查询音频检测结果)主动轮询获取检测结果;
|
||||
- 支持识别违规内容,包括:低俗、谩骂、色情、广告等场景;
|
||||
- 支持批量提交检测任务,检测任务列表**最多支持10个**。
|
||||
|
||||
### 音频文件流调用说明:
|
||||
- 音频文件大小支持:**文件 < 500M**;
|
||||
- 音频文件时长支持:**< 1小时**;
|
||||
- 音频码率类型支持:128 Kbps - 256 Kbps ;
|
||||
- 音频文件支持格式:wav、mp3、aac、flac、amr、3gp、 m4a、wma、ogg、ape;
|
||||
- (**当输入为视频文件时**)支持分离视频文件音轨,并对音频内容进行独立审核。
|
||||
|
||||
### 直播音频流调用说明:
|
||||
- 音频流时长支持:**24小时以内**,超过需要重新推送审核任务;
|
||||
- 音频码率类型支持:128 Kbps - 256 Kbps ;
|
||||
- 音频流支持的传输协议:RTMP、HTTP、HTTPS;
|
||||
- 音频流格式支持的类型:rtp、srtp、rtmp、rtmps、mmsh、 mmst、hls、http、tcp、https、m3u8;
|
||||
- (**当输入为视频流时**)支持提取视频流音轨,并对音频内容进行独立审核。
|
||||
|
||||
### 直播断流处理说明:
|
||||
- 请确认已对接[取消任务](https://cloud.tencent.com/document/product/1219/53258)。
|
||||
- 如果直播任务取消/结束,则终止直播拉流并退出审核。
|
||||
- 在直播任务未取消或结束的情况下,若推流中断(例如 `Operation not permitted` 错误),审核服务将在 10分钟内持续尝试重新拉流。检测到有效的图片或音频数据,审核将自动恢复正常;否则,10分钟后终止拉流并退出审核。此时如有需要,请重新提交审核请求。对于因网络问题导致的拉流失败(如 `HTTP 404 Not Found` 错误),系统将进行最多 16次重试。若成功获取有效数据,审核流程即刻恢复;若所有重试均失败,则同样终止拉流并退出审核,需用户重新送审。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "CreateAudioModerationTask"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.CreateAudioModerationTaskResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeTaskDetail(
|
||||
self,
|
||||
request: models.DescribeTaskDetailRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeTaskDetailResponse:
|
||||
"""
|
||||
通过该接口可查看音频审核任务的详情信息,包括任务状态、检测结果、音频文件识别出的对应文本内容、检测结果所对应的恶意标签及推荐的后续操作等,具体输出内容可查看输出参数示例。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeTaskDetail"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeTaskDetailResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeTasks(
|
||||
self,
|
||||
request: models.DescribeTasksRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeTasksResponse:
|
||||
"""
|
||||
通过该接口可查看审核任务列表;您也可根据多种业务信息(业务类型、审核结果、任务状态等)筛选审核任务列表。任务列表输出内容包括当前查询的任务总量、任务名称、任务状态、音频审核类型、基于检测结果的恶意标签及其后续操作等,具体输出内容可查看输出参数示例。<br>默认接口请求频率限制:**20次/秒**。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeTasks"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeTasksResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
@@ -0,0 +1,105 @@
|
||||
# -*- 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.
|
||||
|
||||
|
||||
# DryRun 操作,代表请求将会是成功的,只是多传了 DryRun 参数。
|
||||
DRYRUNOPERATION = 'DryRunOperation'
|
||||
|
||||
# 操作失败。
|
||||
FAILEDOPERATION = 'FailedOperation'
|
||||
|
||||
# 内部错误。
|
||||
INTERNALERROR = 'InternalError'
|
||||
|
||||
# InternalError.InternalError
|
||||
INTERNALERROR_INTERNALERROR = 'InternalError.InternalError'
|
||||
|
||||
# 参数错误。
|
||||
INVALIDPARAMETER = 'InvalidParameter'
|
||||
|
||||
# InvalidParameter.ImageSizeTooSmall
|
||||
INVALIDPARAMETER_IMAGESIZETOOSMALL = 'InvalidParameter.ImageSizeTooSmall'
|
||||
|
||||
# InvalidParameter.InvalidImageContent
|
||||
INVALIDPARAMETER_INVALIDIMAGECONTENT = 'InvalidParameter.InvalidImageContent'
|
||||
|
||||
# InvalidParameter.ParameterError
|
||||
INVALIDPARAMETER_PARAMETERERROR = 'InvalidParameter.ParameterError'
|
||||
|
||||
# 参数取值错误。
|
||||
INVALIDPARAMETERVALUE = 'InvalidParameterValue'
|
||||
|
||||
# InvalidParameterValue.EmptyImageContent
|
||||
INVALIDPARAMETERVALUE_EMPTYIMAGECONTENT = 'InvalidParameterValue.EmptyImageContent'
|
||||
|
||||
# InvalidParameterValue.ImageSizeTooSmall
|
||||
INVALIDPARAMETERVALUE_IMAGESIZETOOSMALL = 'InvalidParameterValue.ImageSizeTooSmall'
|
||||
|
||||
# InvalidParameterValue.InvalidContent
|
||||
INVALIDPARAMETERVALUE_INVALIDCONTENT = 'InvalidParameterValue.InvalidContent'
|
||||
|
||||
# InvalidParameterValue.InvalidDataId
|
||||
INVALIDPARAMETERVALUE_INVALIDDATAID = 'InvalidParameterValue.InvalidDataId'
|
||||
|
||||
# InvalidParameterValue.InvalidFileContentSize
|
||||
INVALIDPARAMETERVALUE_INVALIDFILECONTENTSIZE = 'InvalidParameterValue.InvalidFileContentSize'
|
||||
|
||||
# InvalidParameterValue.InvalidImageContent
|
||||
INVALIDPARAMETERVALUE_INVALIDIMAGECONTENT = 'InvalidParameterValue.InvalidImageContent'
|
||||
|
||||
# InvalidParameterValue.InvalidParameter
|
||||
INVALIDPARAMETERVALUE_INVALIDPARAMETER = 'InvalidParameterValue.InvalidParameter'
|
||||
|
||||
# 超过配额限制。
|
||||
LIMITEXCEEDED = 'LimitExceeded'
|
||||
|
||||
# 缺少参数错误。
|
||||
MISSINGPARAMETER = 'MissingParameter'
|
||||
|
||||
# 操作被拒绝。
|
||||
OPERATIONDENIED = 'OperationDenied'
|
||||
|
||||
# 请求的次数超过了频率限制。
|
||||
REQUESTLIMITEXCEEDED = 'RequestLimitExceeded'
|
||||
|
||||
# 资源被占用。
|
||||
RESOURCEINUSE = 'ResourceInUse'
|
||||
|
||||
# 资源不足。
|
||||
RESOURCEINSUFFICIENT = 'ResourceInsufficient'
|
||||
|
||||
# 资源不存在。
|
||||
RESOURCENOTFOUND = 'ResourceNotFound'
|
||||
|
||||
# 资源不可用。
|
||||
RESOURCEUNAVAILABLE = 'ResourceUnavailable'
|
||||
|
||||
# ResourceUnavailable.InvalidImageContent
|
||||
RESOURCEUNAVAILABLE_INVALIDIMAGECONTENT = 'ResourceUnavailable.InvalidImageContent'
|
||||
|
||||
# 资源售罄。
|
||||
RESOURCESSOLDOUT = 'ResourcesSoldOut'
|
||||
|
||||
# 未授权操作。
|
||||
UNAUTHORIZEDOPERATION = 'UnauthorizedOperation'
|
||||
|
||||
# 未开通权限/无有效套餐包/账号已欠费。
|
||||
UNAUTHORIZEDOPERATION_UNAUTHORIZED = 'UnauthorizedOperation.Unauthorized'
|
||||
|
||||
# 未知参数错误。
|
||||
UNKNOWNPARAMETER = 'UnknownParameter'
|
||||
|
||||
# 操作不支持。
|
||||
UNSUPPORTEDOPERATION = 'UnsupportedOperation'
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user