AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
ListProjects
搭配使用 AWS SDK
以下代码示例演示如何使用 ListProjects
。
有关更多信息,请参阅查看项目。
- Python
-
- SDK适用于 Python (Boto3)
-
注意
还有更多相关信息 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 SDKPython (Boto3) API 参考。
-
ListModels
StartModel