예제 #1
0
 def check_valid(self):
     '''
     检查配置是否有效
     '''
     accesser = AccessTokenManager(app_key=self.qr_app_id,\
         app_secret=self.qr_app_secret, token_version=TOKEN_FROM_APPID_QR_APP_SECRET)
     try:
         accesser.get_access_token()
         return True
     except ServerException as exce:
         print(exce)
         return False
     except RuntimeError:
         return True
예제 #2
0
 def get_access_token():
     '''
     get ding api access token
     '''
     ding_config = DingConfig.get_current()
     token_manager = AccessTokenManager(
         app_key=ding_config.app_key,
         app_secret=ding_config.app_secret,
     )
     return token_manager.get_access_token()