目录:企业微信API其他篇
目录:
返回顶部
官方文档:http://work.weixin.qq.com/api/doc#10025
返回顶部
官方文档: http://work.weixin.qq.com/api/doc#10087
# -*- coding:UTF-8 -*- import urllib2 import urllib import json def get_access_token(): url = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken?' # corpid: 每个企业都拥有唯一的corpid corpsecret: 自建应用secret para = {'corpid':'ww2f9a1a85f1806981','corpsecret':'tGFtVLxmjxPf6jj2t5SKyqEUYkpCM9e2hw-OrwSQwSg'} req = urllib2.Request(url + urllib.urlencode(para)) ret = urllib2.urlopen(req) ret = json.loads(ret.read()) return ret token_id = get_access_token().get('access_token') def read_app_info(token_id,agentid): ''' 获取执行用户信息 :param token_id: 用于认证的access_token :param agentid: 自建应用id ''' url = 'https://qyapi.weixin.qq.com/cgi-bin/agent/get?' para = {'access_token': token_id, 'agentid':agentid} req = urllib2.Request(url + urllib.urlencode(para)) ret = urllib2.urlopen(req) ret = json.loads(ret.read()) print ret read_app_info(token_id, 1000002)