feat: 新增 API 获取内容方式并优化微信发布流程

This commit is contained in:
王鹏
2026-04-13 15:41:39 +08:00
parent 165b32f74a
commit 245f9cdf41
4 changed files with 106 additions and 23 deletions

View File

@@ -184,7 +184,8 @@ def publish_to_wechat(
appid: str,
appsecret: str,
thumb_image_path: Optional[str] = None,
thumb_image_url: Optional[str] = None
thumb_image_url: Optional[str] = None,
author: str = ""
) -> bool:
"""
便捷函数:发布文章到微信公众号草稿箱
@@ -196,6 +197,7 @@ def publish_to_wechat(
appsecret: 微信公众号 AppSecret
thumb_image_path: 封面图片本地路径(可选,与 thumb_image_url 二选一)
thumb_image_url: 封面图片URL可选与 thumb_image_path 二选一)
author: 作者
Returns:
是否成功
@@ -219,7 +221,8 @@ def publish_to_wechat(
result = publisher.add_draft(
title=title,
content=content,
thumb_media_id=thumb_media_id
thumb_media_id=thumb_media_id,
author=author
)
print(f"[WeChat] 草稿添加成功media_id: {result.get('media_id')}")