> For the complete documentation index, see [llms.txt](https://smallso.gitbook.io/tencent-cloud-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/other-products/class-and-method/universal-client/select-action.md).

# select\_action 方法

## 简要

选择一个 Tencent Cloud API 并为其创建可供直接调用的 Python 原生函数实例。

```python
def select_action(self,
    action_id: str,
    action_version: str
)
```

## 参数

该方法具有以下参数，其参数、参数类型和参数描述如下：

| 参数              | 类型  | 必选 | 描述                                                                  |
| --------------- | --- | -- | ------------------------------------------------------------------- |
| action\_id      | str | 是  | <p>Tencent Cloud API 唯一标识符。</p><p>例如：<code>DescribeZones</code></p> |
| action\_version | str | 是  | <p>Tencent Cloud API 版本名称。</p><p>例如：<code>2017-03-12</code></p>     |

## 返回值

该方法返回一个可供调用的 Python 原生函数实例。

返回的函数实例包含 2 个参数，其参数、参数类型和参数描述如下：

| 参数                 | 类型   | 必选 | 描述                                                                                                    |
| ------------------ | ---- | -- | ----------------------------------------------------------------------------------------------------- |
| region\_id         | str  | 是  | <p>数据中心园区的可用区唯一标识符。</p><p>例如：<code>ap-shanghai-1</code></p>                                           |
| action\_parameters | dict | 否  | <p>包含 Tencent Cloud API 参数和参数值的字典实例。</p><p>对于没有参数的 Tencent Cloud API，该参数应该被设置为 <code>None</code>。</p> |

返回的函数实例在内部将调用 `action` 方法，其返回值与 `action` 方法一致。

## 异常

该方法不会主动引发任何异常。

## 示例

接下来我们将通过一段 Python 代码向您演示如何使用该方法：

```python
describe_zones_action = virtual_machine_client.select_action(
    action_id = 'DescribeZones',
    action_version = '2017-03-12'
)

action_result: dict = describe_zones_action(
    region_id = 'ap-shanghai',
    action_parameters = None
)
```

## 适用于

#### Tencent Cloud SDK for Python

基础软件包：tencent-cloud-sdk-core >= 0.1.1
