import requests
class dingding():
#获取钉钉的access_token
def ding_get_token(self):
url=DINGURL+'/gettoken'
param ={"appkey":APPKEY,"appsecret":APPSECRET}
try:
res = requests.get(url=url, params = param, timeout=10)
if res.status_code == 200:
text = json.loads(res.text)
except Exception as e:
text ={"errmsg":e, "errcode":9999}
return text
#获取钉钉的用户userid
def ding_get_userid(self, code):
url = DINGURL + '/user/getuserinfo'
token = self.ding_get_token()
if token.get('errcode') == 0:
access_token =token.get('access_token')
param = {"access_token":access_token, "code":code}
try:
res =