# Client 类

## 简要

代表无服务器云函数产品客户端的类。利用该类，您可以以同步或异步面向对象编程的方式快速、安全地与无服务器云函数产品交互。

```python
class Client(client.AbstractClient)
```

继承：`tencent.cloud.serverless.functions.client.AbstractClient` 类

### 兼容性

从产品软件包 `tencent-cloud-sdk-serverless-functions` 的 0.1.3 版本开始，无服务器云函数产品客户端类型将不再继承自 `BaseClient`，而是 `UniversalClient`。

* `tencent.cloud.serverless.functions.Client` 类
  * `tencent.cloud.serverless.functions.client.AbstractClient` 类
    * `tencent.cloud.core.client.UniversalClient` 类
      * `tencent.cloud.core.client.BaseClient` 类

{% content-ref url="/pages/-M-nRQrhsnyenayFSRBP" %}
[UniversalClient 类](/tencent-cloud-sdk/python-docs/other-products/class-and-method/universal-client.md)
{% endcontent-ref %}

## 构造

该类仅支持构造类实例后使用，构造实例方法继承自父类，其构造实例方法签名如下：

```python
def __init__(self,
    access_credentials: credentials.Credentials = None,
    access_proxies: proxies.Proxies = None
)
```

构造实例方法参数和参数描述如下：

| 参数                  | 类型                                                                                                          | 必选 | 描述                                           |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | -- | -------------------------------------------- |
| access\_credentials | Credentials                                                                                                 | 否  | 访问凭据类实例。如果该参数被忽略或设置为 `None`，默认设置为环境凭据或文件凭据。  |
| access\_proxies     | [Proxies](https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/other-products/class-and-method/proxies) | 否  | 代理服务器配置类实例。如果该参数被忽略或设置为 `None`，默认不使用任何代理服务器。 |

### 兼容性

请注意，对于 Tencent Cloud SDK for Python 0.1.3 或更低版本，参数名称为：

| 文档中的参数名             | 旧的参数名                | 类型一致 | 行为一致 |
| ------------------- | -------------------- | ---- | ---- |
| access\_credentials | credentials\_context | 是    | 是    |
| access\_proxies     | proxies\_context     | 是    | 是    |

值得注意的是，旧版本除参数名称不同外，与新版本中的参数数据类型和行为是一致的。

## 属性

该类型的实例包含可被公开访问的属性有：

| 属性             | 类型           | 只读 | 描述                                                                                                                                                                                                                                                                                                                  |
| -------------- | ------------ | -- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| error\_manager | ErrorManager | 是  | 当前无服务云函数产品客户端实例的错误管理器实例。借助错误管理器，您可以自定义对感兴趣地错误的处理方式。                                                                                                                                                                                                                                                                 |
| credentials    | Credentials  | 是  | 当前无服务器云函数产品客户端实例所绑定的访问凭据实例。                                                                                                                                                                                                                                                                                         |
| proxies        | Proxies      | 是  | <p>当前无服务器云函数产品客户端实例所绑定的一个或多个代理服务器配置实例。如果需要修改代理服务器配置，请使用 <a href="https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/other-products/class-and-method/universal-client/set-access-proxies"><code>set\_access\_proxies</code></a> 方法。</p><p></p><p>请注意，如果当前无服务器云函数产品客户端未设置代理服务器配置，该属性默认值为 <code>None</code>。</p> |

### 兼容性

该类型部分可被公开访问的属性可能需要最新的 Tencent Cloud SDK for Python 版本：

| 属性             | 软件包                    | 版本要求     |
| -------------- | ---------------------- | -------- |
| error\_manager | tencent-cloud-sdk-core | >= 0.1.2 |
| credentials    | tencent-cloud-sdk-core | >= 0.1.2 |
| proxies        | tencent-cloud-sdk-core | >= 0.1.3 |

## 示例

在下文中我们将向您演示如何构造一个无服务器云函数产品客户端类实例：

```python
from tencent.cloud.auth import credentials
from tencent.cloud.serverless import functions

# Please replace with your access credentials

access_credentials = credentials.Credentials(
    secret_id = 'AKIDF3sMOAU1pOgkmrKHchX6TZQ1Mo1C5qa7',
    secret_key = 'b4JL8fwxkIgsKMXGi39yYt0ECxZw4wZf'
)

function_client: functions.Client = functions.Client(
    access_credentials = access_credentials,
    access_proxies = None
)
```

## 适用于

#### Tencent Cloud SDK for Python

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/serverless-functions/class-and-method/client.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
