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)

page = 1
num_projects = 1
project_list = []
while len(project_list) < num_projects:
    response = ango_sdk.list_projects(page=page, limit=50)
    projects = response.get('data', {}).get('projects', [])
    num_projects = response.get('data', {}).get('total', 0)

    project_list.extend(projects)
    page += 1

print("The number of retrieved projects is: " + str(len(project_list)))

Last updated