Files
test/sg_wechat_enterprise/we_api/client/api/template.py
2024-07-10 15:58:47 +08:00

46 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from wechatpy.client.api.base import BaseWeChatAPI
class WeChatTemplate(BaseWeChatAPI):
def set_industry(self, industry_id1, industry_id2):
"""
设置所属行业
详情请参考
http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param industry_id1: 公众号模板消息所属行业编号
:param industry_id2: 公众号模板消息所属行业编号
:return: 返回的 JSON 数据包
"""
return self._post(
'template/api_set_industry',
data={
'industry_id1': industry_id1,
'industry_id2': industry_id2
}
)
def get(self, template_id_short):
"""
获得模板ID
详情请参考
http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param template_id_short: 模板库中模板的编号有“TM**”和“OPENTMTM**”等形式
:return: 模板 ID
"""
res = self._post(
'template/api_add_template',
data={
'template_id_short': template_id_short
},
result_processor=lambda x: x['template_id']
)
return res
add = get