文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
ListProjects
搭配 a AWS SDK 使用
下列程式碼範例示範如何使用 ListProjects
。
如需詳細資訊,請參閱檢視專案。
- Python
-
- SDK for Python (Boto3)
-
注意
還有更多 on GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 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
-
如需 API 詳細資訊,請參閱 ListProjects AWS SDK for Python (Boto3) Word 參考中的 API。
-
ListModels
StartModel