Skip to content

Commit

Permalink
remove dup add_drafts (#718)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldsink committed Mar 27, 2022
1 parent 9c33ac5 commit c02f169
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions wechatpy/client/api/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,6 @@


class WeChatMaterial(BaseWeChatAPI):
def add_drafts(self, articles):
"""
新增草稿素材, 原 新增永久图文素材
用于替换原本的新增永久图文素材add_articles方法(接口为add_news)
详情参考
https://developers.weixin.qq.com/doc/offiaccount/Draft_Box/Add_draft.html
:param articles: 图文素材数组
:type articles: list[dict]
:return: 返回的 JSON 数据包
"""
articles_data = []
for article in articles:
articles_data.append(
{
"title": article["title"],
"author": article.get("author", ""),
"digest": article.get("digest", ""),
"content": article["content"],
"content_source_url": article.get("content_source_url", ""),
"thumb_media_id": article["thumb_media_id"],
"need_open_comment": int(article.get("need_open_comment", False)),
"only_fans_can_comment": int(article.get("only_fans_can_comment", False)),
}
)
return self._post("draft/add", data={"articles": articles_data})

def submit(self, media_id):
"""
发布图文消息,前置条件是先将其存为草稿(使用add_drafts方法)
Expand Down

0 comments on commit c02f169

Please sign in to comment.