Appearance
CDN
CDN 接口用于文件上传和下载操作。
cdn_init
初始化 CDN 服务。使用 CDN 上传/下载前需先调用。
python
wechat.cdn_init(client_id, timeout=None)| 参数 | 类型 | 说明 |
|---|---|---|
| client_id | int | 客户端ID |
| timeout | int | 超时时间(秒) |
cdn_upload
上传文件到 CDN。
python
wechat.cdn_upload(client_id, file_type, file_path, timeout=None)| 参数 | 类型 | 说明 |
|---|---|---|
| client_id | int | 客户端ID |
| file_type | int | 文件类型 |
| file_path | str | 本地文件路径 |
| timeout | int | 超时时间(秒) |
cdn_download
从 CDN 下载文件。
python
wechat.cdn_download(client_id, file_id, aes_key, save_path, file_type, timeout=None)| 参数 | 类型 | 说明 |
|---|---|---|
| client_id | int | 客户端ID |
| file_id | str | CDN文件ID |
| aes_key | str | AES密钥 |
| save_path | str | 保存路径 |
| file_type | int | 文件类型 |
| timeout | int | 超时时间(秒) |
cdn_download2
企业微信 CDN 下载。
python
wechat.cdn_download2(client_id, url, auth_key, aes_key, save_path, timeout=None)| 参数 | 类型 | 说明 |
|---|---|---|
| client_id | int | 客户端ID |
| url | str | 下载URL |
| auth_key | str | 认证密钥 |
| aes_key | str | AES密钥 |
| save_path | str | 保存路径 |
| timeout | int | 超时时间(秒) |
cdn_download_voice
下载语音消息。
python
wechat.cdn_download_voice(client_id, msg_id, timeout=None)| 参数 | 类型 | 说明 |
|---|---|---|
| client_id | int | 客户端ID |
| msg_id | str | 消息ID |
| timeout | int | 超时时间(秒) |
cdn_download_moment_media
下载朋友圈媒体文件。
python
wechat.cdn_download_moment_media(client_id, file_path, enc_len, decode_key, save_path, timeout=None)| 参数 | 类型 | 说明 |
|---|---|---|
| client_id | int | 客户端ID |
| file_path | str | 媒体路径 |
| enc_len | int | 加密长度 |
| decode_key | str | 解码密钥 |
| save_path | str | 保存路径 |
| timeout | int | 超时时间(秒) |