There are more AWS SDK examples available in the AWS Doc SDK Examples
Use ListProjects
with an AWS SDK
The following code example shows how to use ListProjects
.
For more information, see Viewing your projects.
- Python
-
- SDK for Python (Boto3)
-
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. class Projects: @staticmethod def list_projects(lookoutvision_client): """ Lists information about the projects that are in in your AWS account and in the current AWS Region. :param lookoutvision_client: A Boto3 Lookout for Vision client. """ try: response = lookoutvision_client.list_projects() for project in response["Projects"]: print("Project: " + project["ProjectName"]) print("\tARN: " + project["ProjectArn"]) print("\tCreated: " + str(["CreationTimestamp"])) print("Datasets") project_description = lookoutvision_client.describe_project( ProjectName=project["ProjectName"] ) if not project_description["ProjectDescription"]["Datasets"]: print("\tNo datasets") else: for dataset in project_description["ProjectDescription"][ "Datasets" ]: print(f"\ttype: {dataset['DatasetType']}") print(f"\tStatus: {dataset['StatusMessage']}") print("Models") response_models = lookoutvision_client.list_models( ProjectName=project["ProjectName"] ) if not response_models["Models"]: print("\tNo models") else: for model in response_models["Models"]: Models.describe_model( lookoutvision_client, project["ProjectName"], model["ModelVersion"], ) print("------------------------------------------------------------\n") print("Done!") except ClientError: logger.exception("Problem listing projects.") raise
-
For API details, see ListProjects in AWS SDK for Python (Boto3) API Reference.
-
ListModels
StartModel