AccessToken.py 306 B

1234567891011121314
  1. # -*- coding: utf-8 -*-
  2. import dingtalk.api
  3. def access_token(appkey,appsecret):
  4. req= dingtalk.api.rest.OapiGettokenRequest("https://oapi.dingtalk.com/gettoken")
  5. req.appkey=appkey
  6. req.appsecret=appsecret
  7. try:
  8. resp= req.getResponse()
  9. return resp["access_token"]
  10. except Exception as e:
  11. print(e)