Microsoft Azure Cognitive Services 管理客户端库(Python版)
项目描述
Microsoft Azure SDK for Python
这是Microsoft Azure Cognitive Services管理客户端库。该软件包已在Python 3.7+上进行了测试。有关Azure库的更完整视图,请参阅azure sdk python发行版。
免责声明
2022年1月1日起,Azure SDK Python包对Python 2.7的支持已结束。有关更多信息及问题,请参阅https://github.com/Azure/azure-sdk-for-python/issues/20691
入门指南
先决条件
- 使用此包需要Python 3.7及以上版本。
- Azure订阅
安装包
pip install azure-mgmt-cognitiveservices
pip install azure-identity
身份验证
默认情况下,Azure Active Directory令牌身份验证依赖于以下环境变量的正确配置。
AZURE_CLIENT_ID
:用于Azure客户端ID。AZURE_TENANT_ID
:用于Azure租户ID。AZURE_CLIENT_SECRET
:用于Azure客户端密钥。
此外,可以通过环境变量AZURE_SUBSCRIPTION_ID
配置Azure订阅ID。
以上配置后,客户端可以通过以下代码进行身份验证
from azure.identity import DefaultAzureCredential
from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient
import os
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = CognitiveServicesManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id)
示例
此包的代码示例可以在以下位置找到:
故障排除
下一步
提供反馈
如果您遇到任何错误或有建议,请在该项目的问题部分提交问题。
版本历史记录
13.5.0 (2023-07-21)
新增功能
- 添加了操作组ModelsOperations
- 添加了操作组UsagesOperations
- Model AccountModel有一个新参数is_default_version
- Model AccountModel有一个新参数skus
- Model AccountModel有一个新参数source
- Model AccountProperties有一个新参数abuse_penalty
- Model CommitmentPlanProperties有一个新参数provisioning_issues
- Model Deployment有一个新参数sku
- Model DeploymentModel有一个新参数source
- Model DeploymentProperties有一个新参数rate_limits
- Model DeploymentProperties有一个新参数version_upgrade_option
- Model UsageListResult有一个新参数next_link
13.4.0 (2023-02-15)
新增功能
- 添加了操作CommitmentPlansOperations.begin_create_or_update_association
- 添加了操作CommitmentPlansOperations.begin_create_or_update_plan
- 添加了操作CommitmentPlansOperations.begin_delete_association
- 添加了操作CommitmentPlansOperations.begin_delete_plan
- 添加了操作CommitmentPlansOperations.begin_update_plan
- 添加了操作CommitmentPlansOperations.get_association
- 添加了操作CommitmentPlansOperations.get_plan
- 添加了操作CommitmentPlansOperations.list_associations
- 添加了操作CommitmentPlansOperations.list_plans_by_resource_group
- 添加了操作CommitmentPlansOperations.list_plans_by_subscription
- Model AccountModel有一个新参数finetune_capabilities
- Model AccountModel有一个新参数lifecycle_status
- Model AccountProperties有一个新参数commitment_plan_associations
- Model AccountProperties有一个新参数locations
- Model CommitmentPlan有一个新参数kind
- Model CommitmentPlan有一个新参数location
- Model CommitmentPlan有一个新参数sku
- Model CommitmentPlan有一个新参数tags
- Model CommitmentPlanProperties有一个新参数commitment_plan_guid
- Model CommitmentPlanProperties有一个新参数provisioning_state
13.4.0b1 (2022-12-29)
新增功能
- 添加了操作CommitmentPlansOperations.begin_create_or_update_association
- 添加了操作CommitmentPlansOperations.begin_create_or_update_plan
- 添加了操作CommitmentPlansOperations.begin_delete_association
- 添加了操作CommitmentPlansOperations.begin_delete_plan
- 添加了操作CommitmentPlansOperations.begin_update_plan
- 添加了操作CommitmentPlansOperations.get_association
- 添加了操作CommitmentPlansOperations.get_plan
- 添加了操作CommitmentPlansOperations.list_associations
- 添加了操作CommitmentPlansOperations.list_plans_by_resource_group
- 添加了操作CommitmentPlansOperations.list_plans_by_subscription
- Model AccountModel有一个新参数finetune_capabilities
- Model AccountModel有一个新参数lifecycle_status
- Model AccountProperties有一个新参数commitment_plan_associations
- Model AccountProperties有一个新参数locations
- Model CommitmentPlan有一个新参数kind
- Model CommitmentPlan有一个新参数location
- Model CommitmentPlan有一个新参数sku
- Model CommitmentPlan有一个新参数tags
- Model CommitmentPlanProperties有一个新参数commitment_plan_guid
- Model CommitmentPlanProperties有一个新参数provisioning_state
13.3.0 (2022-10-24)
新增功能
- Model AccountModel有一个新参数call_rate_limit
- Model DeploymentModel有一个新参数call_rate_limit
- Model DeploymentProperties有一个新参数call_rate_limit
- Model DeploymentProperties有一个新参数capabilities
- Model DeploymentProperties有一个新参数rai_policy_name
13.2.0 (2022-06-08)
功能
- Model DeploymentScaleType的
scale_type
有一个新的枚举类型STANDARD
13.1.0 (2022-03-25)
功能
- 添加了操作AccountsOperations.list_models
- Model AccountProperties有一个新参数deletion_date
- Model AccountProperties有一个新参数dynamic_throttling_enabled
- Model AccountProperties有一个新参数scheduled_purge_date
- Model DeploymentScaleSettings有一个新参数active_capacity
13.0.0 (2021-11-15)
功能
- Model DomainAvailability有一个新参数kind
- Model CheckDomainAvailabilityParameter有一个新参数kind
- 添加了操作组CommitmentPlansOperations
- 添加了操作组CommitmentTiersOperations
- 添加了操作组DeploymentsOperations
重大更改
- CognitiveServicesManagementClientOperationsMixin.check_domain_availability操作有新的签名
12.0.0 (2021-06-03)
功能
- Model UserOwnedStorage 添加了新参数 identity_client_id
- Model Sku 添加了新参数 family
- Model Sku 添加了新参数 capacity
- Model Sku 添加了新参数 size
- Model PrivateEndpointConnection 添加了新参数 location
- Model PrivateEndpointConnection 添加了新参数 system_data
- Model PrivateEndpointConnection 添加了新参数 etag
- Model PrivateEndpointConnectionProperties 添加了新参数 provisioning_state
- Model KeyVaultProperties 添加了新参数 identity_client_id
- Model PrivateLinkServiceConnectionState 添加了新参数 actions_required
- 添加了操作 PrivateEndpointConnectionsOperations.begin_create_or_update
- 添加了操作 PrivateEndpointConnectionsOperations.begin_delete
- 添加了操作 AccountsOperations.list_usages
- 添加了操作 AccountsOperations.begin_delete
- 添加了操作 AccountsOperations.get
- 添加了操作 AccountsOperations.begin_create
- 添加了操作 AccountsOperations.begin_update
- 添加了操作组 DeletedAccountsOperations
重大更改
- Model PrivateLinkServiceConnectionState 不再具有参数 action_required
- 移除了操作 PrivateEndpointConnectionsOperations.create_or_update
- 移除了操作 PrivateEndpointConnectionsOperations.delete
- 移除了操作 AccountsOperations.delete
- 移除了操作 AccountsOperations.create
- 移除了操作 AccountsOperations.get_usages
- 移除了操作 AccountsOperations.update
- 移除了操作 AccountsOperations.get_properties
11.0.0 (2020-12-22)
功能
- Model CognitiveServicesAccountProperties 添加了新参数 date_created
11.0.0b1 (2020-11-03)
这是一个测试预览版本。
此版本使用新一代代码生成器,引入了重要的破坏性更改,但也引入了重要的新功能(如统一身份验证和异步编程)。
通用破坏性更改
-
凭证系统已完全重构成新
azure.common.credentials
或msrestazure.azure_active_directory
实例不再受支持,请使用azure-identity
类:[https://pypi.ac.cn/project/azure-identity/](https://pypi.ac.cn/project/azure-identity/)credentials
参数已重命名为credential
-
客户端上的
config
属性不再存在,配置应作为关键字参数传递。例如:MyClient(credential, subscription_id, enable_logging=True)
。有关受支持的完整选项集,请参阅 azure-core 初始化文档中的参数接受 -
不能再导入
version
模块,请使用__version__
代替 -
以前返回
msrest.polling.LROPoller
的操作现在返回azure.core.polling.LROPoller
,并带有begin_
前缀。 -
异常树已被简化,大多数异常现在都是
azure.core.exceptions.HttpResponseError
(已删除CloudError
)。 -
大多数操作关键字参数已更改。其中一些最明显的是:
raw
已被移除。等效功能可以通过使用cls
来找到,它将为高级用户提供对内部 HTTP 响应的访问- 有关受支持的完整选项集,请参阅 azure-core 请求文档中的参数接受
通用新功能
- 支持使用
typing
进行类型注解。SDKs 已准备好 mypy。 - 此客户端现在具有稳定和官方的异步支持。检查您包中的
aio
命名空间以找到异步客户端。 - 此客户端现在原生支持 OpenCensus 或 OpenTelemetry 等跟踪库。有关概述,请参阅此 跟踪快速入门
6.3.0 (2020-10-09)
功能
- Model CognitiveServicesAccountApiProperties 添加了新参数 website_name
- Model CognitiveServicesAccountApiProperties 添加了新参数 super_user
- Model CognitiveServicesAccountApiProperties 添加了新参数 aad_client_id
- Model CognitiveServicesAccountApiProperties 添加了新参数 aad_tenant_id
- 添加了操作 PrivateEndpointConnectionsOperations.list
6.2.0 (2020-05-29)
功能
- Model CognitiveServicesAccountProperties 添加了新参数 public_network_access
- Model CognitiveServicesAccountProperties 添加了新参数 private_endpoint_connections
- Model CognitiveServicesAccountProperties 添加了新参数 capabilities
- 添加了操作组 PrivateEndpointConnectionsOperations
- 添加了操作组 PrivateLinkResourcesOperations
6.1.0 (2020-03-25)
功能
- 模型 CognitiveServicesAccount 新增了参数 identity
- 模型 CognitiveServicesAccountProperties 新增了参数 user_owned_storage
- 模型 CognitiveServicesAccountProperties 新增了参数 encryption
6.0.0 (2020-02-07)
功能
- 模型 CognitiveServicesAccount 新增了参数 properties
- 添加了操作 CognitiveServicesManagementClientOperationsMixin.check_sku_availability
重大更改
- 操作 AccountsOperations.create 有新的签名
- 模型 CognitiveServicesAccount 不再包含参数 network_acls
- 模型 CognitiveServicesAccount 不再包含参数 provisioning_state
- 模型 CognitiveServicesAccount 不再包含参数 internal_id
- 模型 CognitiveServicesAccount 不再包含参数 custom_sub_domain_name
- 模型 CognitiveServicesAccount 不再包含参数 endpoint
- 模型 NetworkRuleSet 不再包含参数 bypass
- 操作 AccountsOperations.update 有新的签名
- 移除了操作组 CheckSkuAvailabilityOperations
5.0.0 (2019-06-21)
功能
- 模型 CognitiveServicesAccount 新增了参数 network_acls
- 添加了操作 check_domain_availability
一般性重大更改
本版本使用下一代代码生成器,可能会对某些导入引起破坏性更改。总结来说,一些模块被错误地可见或可导入,并已被重命名。这修复了由于使用本不应使用的类而引起的一些问题。
- 无法从
azure.mgmt.cognitiveservices.v20xx_yy_zz.cognitive_services_management_client
导入 CognitiveServicesManagementClient(从azure.mgmt.cognitiveservices.v20xx_yy_zz
的导入仍然像以前一样工作) - CognitiveServicesManagementClientConfiguration 的导入已从
azure.mgmt.cognitiveservices.v20xx_yy_zz.cognitive_services_management_client
移至azure.mgmt.cognitiveservices.v20xx_yy_zz
- 从 "models" 子模块的模型
MyClass
不能再使用azure.mgmt.cognitiveservices.v20xx_yy_zz.models.my_class
导入(从azure.mgmt.cognitiveservices.v20xx_yy_zz.models
的导入仍然像以前一样工作) - 从
operations
子模块的操作类MyClassOperations
不能再使用azure.mgmt.cognitiveservices.v20xx_yy_zz.operations.my_class_operations
导入(从azure.mgmt.cognitiveservices.v20xx_yy_zz.operations
的导入仍然像以前一样工作)
最后但同样重要的是,HTTP 连接池现在默认启用。您应始终将客户端作为上下文管理器使用,或调用 close(),或每个进程使用不超过一个客户端。
4.0.0 (2019-05-01)
功能
- 模型 CognitiveServicesAccount 新增了参数 custom_sub_domain_name
- 模型 CognitiveServicesAccountUpdateParameters 新增了参数 properties
- 操作 AccountsOperations.update 现在接受可选的 properties
重大更改
- 移除了有限的枚举 Kind 和 SkuName。所有使用都替换为简单的字符串(例如 "Bing.SpellCheck.v7")
3.0.0 (2018-05-21)
一般性重大更改
本版本使用下一代代码生成器,可能会引入破坏性更改。
- 模型签名现在只使用关键字参数语法。所有位置参数必须重写为关键字参数。为了在大多数情况下保持自动完成,模型现在为 Python 2 和 Python 3 生成。Python 3 使用 "*" 语法表示关键字唯一参数。
- 枚举类型现在使用 "str" 混合(类 AzureEnum(str, Enum))来改进遇到未识别枚举值时的行为。虽然这不是破坏性更改,但区分很重要,并在此处记录:https://docs.pythonlang.cn/3/library/enum.html#others 简要概述
- 应完全不用 "is"。
- "format" 将返回字符串值,其中 "%s" 字符串格式化将返回
NameOfEnum.stringvalue
。应优先使用格式化语法。
- 新的长时间运行操作
- 返回类型从
msrestazure.azure_operation.AzureOperationPoller
更改为msrest.polling.LROPoller
。外部 API 相同。 - 返回类型现在是 总是
msrest.polling.LROPoller
,无论使用的是可选参数。 - 使用
raw=True
时的行为已更改。现在不再是返回初始调用结果作为ClientRawResponse
而不轮询,而是现在返回一个 LROPoller。轮询后,最终资源将作为ClientRawResponse
返回。 - 新增
polling
参数。默认行为是Polling=True
,将使用 ARM 算法进行轮询。当Polling=False
时,初始调用的响应将返回而不轮询。 polling
参数接受msrest.polling.PollingMethod
子类的实例。add_done_callback
在轮询完成后调用将不再抛出异常,而是立即执行回调。
- 返回类型从
功能
- 添加“resource_skus”操作组
- 更新SKU列表
- 添加“accounts.get_usages”操作
- 客户端类可以作为上下文管理器使用,以保持底层HTTP会话打开以提高性能
错误修复
- 与wheel 0.31.0的sdist兼容性
2.0.0 (2017-10-26)
重大更改
- 移除“location”作为构造函数参数
- “check_sku_availability”结果中的sku_name现在为str(从枚举类型转换而来)
- 将“cognitive_services_accounts”合并到“accounts”操作组
- 现在必须提供“key_name”才能重新生成密钥
- 列出可用的SKU时现在需要“location/skus/kind/type”
1.0.0 (2017-05-01)
- 无变化,这是0.30.0版本已批准为稳定版。
0.30.0 (2017-05-01)
- 初始发布(ApiVersion 2017-04-18)
- 此wheel软件包现在使用azure wheel扩展构建
项目详情
下载文件
下载适合您平台文件的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源分布
构建分布
哈希 for azure_mgmt_cognitiveservices-13.5.0-py3-none-any.whl
算法 | 哈希摘要 | |
---|---|---|
SHA256 | f13e17e2283c802ed6b67e2fc70885224a216a713f921881e397dd29a29a13df |
|
MD5 | 9d5424342ff0708780da06145dda1788 |
|
BLAKE2b-256 | bcf052e775a5bc9db1c7dc5a49b6a6274f8e33ea3352ac275df26546b663212a |