list_projects

imerit_ango.sdk.SDK.

list_projects(page, limit)

Lists projects from the current users' organization.

Projects are paginated. A maximum of 1000 projects can be obtained per page. See the second code example for more on how it works.

Parameters

  • page: int, default 1

    • Current page.

    • Example: 1

  • limit: int, default 10, maximum 1000

    • Number of projects per page.

    • Example: 100

Returns:

  • output: dict

Example

List the first ten projects from the organization:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')

ango_sdk = SDK(api_key)

sdk_response = ango_sdk.list_projects()
project_list = sdk_response['data']['projects']

print(project_list[0])

List all projects from the organization:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')

ango_sdk = SDK(api_key)

items_per_page = 50
max_limit = None

project_list = []
page = 1
remaining_tasks = 1
while remaining_tasks > 0:
    response = ango_sdk.list_projects(page=page, limit=items_per_page)
    project_list.extend(response['data']['projects'])
    remaining_tasks = response["data"]["total"] - len(project_list)
    page += 1
    if max_limit:
        if len(project_list) >= max_limit:
            project_list = project_list[:max_limit]
            break

print(project_list[0])

Last updated