MCPcopy
hub / github.com/wechatpy/wechatpy / get

Method get

wechatpy/client/api/user.py:11–37  ·  view source on GitHub ↗

获取用户基本信息(包括UnionID机制) 详情请参考 https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839 :param user_id: 普通用户的标识,对当前公众号唯一 :param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语 :return: 返回的 JSON 数据包 使用示例:: from wechatpy import WeC

(self, user_id, lang='zh_CN')

Source from the content-addressed store, hash-verified

9class WeChatUser(BaseWeChatAPI):
10
11 def get(self, user_id, lang='zh_CN'):
12 """
13 获取用户基本信息(包括UnionID机制)
14 详情请参考
15 https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839
16
17 :param user_id: 普通用户的标识,对当前公众号唯一
18 :param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
19 :return: 返回的 JSON 数据包
20
21 使用示例::
22
23 from wechatpy import WeChatClient
24
25 client = WeChatClient('appid', 'secret')
26 user = client.user.get('openid')
27
28 """
29 assert lang in ('zh_CN', 'zh_TW', 'en'), 'lang can only be one of \
30 zh_CN, zh_TW, en language codes'
31 return self._get(
32 'user/info',
33 params={
34 'openid': user_id,
35 'lang': lang
36 }
37 )
38
39 def get_followers(self, first_user_id=None):
40 """

Callers

nothing calls this directly

Calls 1

_getMethod · 0.45

Tested by

no test coverage detected