Skip to content

CDN

CDN 接口用于文件上传和下载操作。

cdn_init

初始化 CDN 服务。使用 CDN 上传/下载前需先调用。

python
wechat.cdn_init(client_id, timeout=None)
参数类型说明
client_idint客户端ID
timeoutint超时时间(秒)

cdn_upload

上传文件到 CDN。

python
wechat.cdn_upload(client_id, file_type, file_path, timeout=None)
参数类型说明
client_idint客户端ID
file_typeint文件类型
file_pathstr本地文件路径
timeoutint超时时间(秒)

cdn_download

从 CDN 下载文件。

python
wechat.cdn_download(client_id, file_id, aes_key, save_path, file_type, timeout=None)
参数类型说明
client_idint客户端ID
file_idstrCDN文件ID
aes_keystrAES密钥
save_pathstr保存路径
file_typeint文件类型
timeoutint超时时间(秒)

cdn_download2

企业微信 CDN 下载。

python
wechat.cdn_download2(client_id, url, auth_key, aes_key, save_path, timeout=None)
参数类型说明
client_idint客户端ID
urlstr下载URL
auth_keystr认证密钥
aes_keystrAES密钥
save_pathstr保存路径
timeoutint超时时间(秒)

cdn_download_voice

下载语音消息。

python
wechat.cdn_download_voice(client_id, msg_id, timeout=None)
参数类型说明
client_idint客户端ID
msg_idstr消息ID
timeoutint超时时间(秒)

cdn_download_moment_media

下载朋友圈媒体文件。

python
wechat.cdn_download_moment_media(client_id, file_path, enc_len, decode_key, save_path, timeout=None)
参数类型说明
client_idint客户端ID
file_pathstr媒体路径
enc_lenint加密长度
decode_keystr解码密钥
save_pathstr保存路径
timeoutint超时时间(秒)

基于 MIT 许可证发布