def download_appstats(servername, appid, path, secure, rpc_server_factory, filename, appdir, merge, java_application):
 if os.path.isdir(appdir):
  sys.path.insert(0, appdir)
  try:
   logging.info('Importing appengine_config from %s', appdir)
   import appengine_config
  except ImportError as err:
   logging.warn('Failed to load appengine_config: %s', err)
 remote_api_stub.ConfigureRemoteApi(appid, path, auth_func, servername=servername, save_cookies=True, secure=secure, rpc_server_factory=rpc_server_factory)
 remote_api_stub.MaybeInvokeAuthentication()
 os.environ['SERVER_SOFTWARE'] = 'Development (remote_api_shell)/1.0'
 if (not appid):
  appid = os.environ['APPLICATION_ID']
 download_data(filename, merge, java_application)

def download_appstats ( servername , appid , path , secure , rpc_server_factory , filename , appdir , merge , java_application ) : if os . path . isdir ( appdir ) : sys . path . insert ( 0 , appdir ) try : logging . info ( 'Importing appengine_config from %s' , appdir ) import appengine_config except ImportError as err : logging . warn ( 'Failed to load appengine_config: %s' , err ) remote_api_stub . ConfigureRemoteApi ( appid , path , auth_func , servername = servername , save_cookies = True , secure = secure , rpc_server_factory = rpc_server_factory ) remote_api_stub . MaybeInvokeAuthentication ( ) os . environ [ 'SERVER_SOFTWARE' ] = 'Development (remote_api_shell)/1.0' if ( not appid ) : appid = os . environ [ 'APPLICATION_ID' ] download_data ( filename , merge , java_application )
invoke remote_api to download appstats data .