> 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/serverless-functions/class-and-method/client/list-layer-versions.md).

# list\_layer\_versions 方法

## 简要

获取已创建就绪的层的所有层版本信息。

```python
def list_layer_versions(self,
    region_id: str,
    layer_name: str,
    requirement_context: dict = None
)
```

## 参数

该方法的参数和参数描述如下：

| 参数                   | 类型   | 必选 | 描述                                                                                                                                          |
| -------------------- | ---- | -- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| region\_id           | str  | 是  | <p>获取的层的数据中心唯一标识符。</p><p>例如：<code>ap-shanghai</code></p>                                                                                    |
| layer\_name          | str  | 时  | 获取的层的唯一名称。                                                                                                                                  |
| requirement\_context | dict | 否  | 包含层过滤器上下文的字典实例，其数据类型为 [LayerFilter](https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/serverless-functions/data-types/layer-filter)。 |

## 返回值

该方法返回一个用于遍历获取符合过滤条件的层信息的生成器实例，生成器实例每次迭代返回包含层信息的字典实例，其数据类型为 [LayerInfo](https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/serverless-functions/data-types/layer-info)。

{% hint style="warning" %}
请注意，由于该方法背后的 Tencent Cloud API 不支持分页检索，该方法将试图一次性获取所有符合条件的层信息。
{% endhint %}

## 异常

该方法可能会主动引发以下异常：

#### ValueError

参数值或类型不符合预期。

#### ActionError

Tencent Cloud API 错误。例如访问凭据无效、给定无服务器云函数不存在等均会引发该异常。

## 示例

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

```python
for layer_info in function_client.list_layer_versions(
    region_id = 'ap-shanghai',
    layer_name = 'default'
):
    print(layer_info['version'])
```

## 适用于

#### Tencent Cloud SDK for Python

产品软件包：tencent-cloud-sdk-serverless-functions >= 0.1.2
