parent
80fd63526e
commit
5e09b59eca
|
@ -68,10 +68,14 @@ class DingDingOps(object):
|
||||||
json=dict(tmp_auth_code=code),
|
json=dict(tmp_auth_code=code),
|
||||||
)
|
)
|
||||||
resp = resp.json()
|
resp = resp.json()
|
||||||
|
print(resp)
|
||||||
try:
|
try:
|
||||||
|
if resp['errcode'] != 0:
|
||||||
|
return False, 'ding_get_union_id_by_code: %s' % str(resp)
|
||||||
|
else:
|
||||||
return True, resp["user_info"]["unionid"]
|
return True, resp["user_info"]["unionid"]
|
||||||
except Exception as e:
|
except Exception:
|
||||||
return False, 'ding_get_union_id_by_code: {}' .format(e)
|
return False, 'ding_get_union_id_by_code: %s' % str(resp)
|
||||||
|
|
||||||
def ding_get_userid_by_union_id(self, union_id):
|
def ding_get_userid_by_union_id(self, union_id):
|
||||||
"""
|
"""
|
||||||
|
@ -82,7 +86,10 @@ class DingDingOps(object):
|
||||||
try:
|
try:
|
||||||
return True, self.ding_client_connect.user.get_userid_by_unionid(union_id)['userid']
|
return True, self.ding_client_connect.user.get_userid_by_unionid(union_id)['userid']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return False, 'ding_get_userid_by_union_id: {}' .format(e)
|
return False, 'ding_get_union_id_by_code: %s' % str(e)
|
||||||
|
|
||||||
|
except (KeyError, IndexError) as k_error:
|
||||||
|
return False, 'ding_get_union_id_by_code: %s' % str(k_error)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ding_get_org_user_count(self):
|
def ding_get_org_user_count(self):
|
||||||
|
@ -102,13 +109,16 @@ class DingDingOps(object):
|
||||||
try:
|
try:
|
||||||
return True, self.ding_client_connect.user.get(user_id)
|
return True, self.ding_client_connect.user.get(user_id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return False, 'ding_get_userinfo_detail: {}' .format(e)
|
return False, 'ding_get_union_id_by_code: %s' % str(e)
|
||||||
|
|
||||||
|
except (KeyError, IndexError) as k_error:
|
||||||
|
return False, 'ding_get_union_id_by_code: %s' % str(k_error)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
start = time.time()
|
start = time.time()
|
||||||
d = DingDingOps()
|
d = DingDingOps().ding_client_connect
|
||||||
print(d.ding_get_access_token)
|
unicode = ''
|
||||||
# print(d.user.getuserinfo('2ecebee187863a8ea2863a7a2fa17b49'))
|
# print(d.)
|
||||||
end = time.time()
|
end = time.time()
|
||||||
print("running:" + str(round((end - start), 3)))
|
print("running:" + str(round((end - start), 3)))
|
||||||
|
|
Loading…
Reference in New Issue