获取App列表

更新时间: 2022-09-22 10:32:33

接口

list_apps

参数

属性

类型

是否必须

描述

scope

string

App的类型。 可选值:“Public” 和 “Private”。

next_marker

string

下一页起始资源标识符, 最后一页该值为空。

max_item_count

int

实际返回最大资源数量。默认值50,最大值100。

返回值

list_apps 方法返回一个 ListResponse 对象。

例子

Python源码:

import time
import batchcompute
from batchcompute import CN_SHENZHEN as REGION
from batchcompute import Client, ClientError

ACCESS_KEY_ID = 'Your Access Key Id'
ACCESS_KEY_SECRET = 'Your Access Key Secret'

client = Client(REGION, ACCESS_KEY_ID, ACCESS_KEY_SECRET)

def list_apps():
    try:
        marker = ''
        max_item = 2
        app_cnt = 0
        scope = 'Private'

        while 1:
            response = client.list_apps(scope, marker, max_item)
            marker = response.NextMarker
            app_cnt += len(response.Items)
            for app in response.Items:
                print app.Name
            if marker.strip() == '':
                break
        print 'Total apps: ',  app_cnt
    except ClientError, e:
        print (e.get_status_code(), e.get_code(), e.get_requestid(), e.get_msg())
if __name__ == '__main__':
    list_apps()

执行结果:

echo
JavaSdkApp
PythonSdkTest
test
test-copy
test_1
Total apps:  6
阿里云首页 批量计算 相关技术圈