# -*- coding: utf-8 -*- import dingtalk.api def access_token(appkey,appsecret): req= dingtalk.api.rest.OapiGettokenRequest("https://oapi.dingtalk.com/gettoken") req.appkey=appkey req.appsecret=appsecret try: resp= req.getResponse() return resp["access_token"] except Exception as e: print(e)