Code examples for Lookout for Vision using AWS SDKs - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Code examples for Lookout for Vision using AWS SDKs

The following code examples show you how to use Amazon Lookout for Vision with an AWS software development kit (SDK).

Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios and cross-service examples.

Scenarios are code examples that show you how to accomplish a specific task by calling multiple functions within the same service.

More resources

Get started

The following code example shows how to get started using Lookout for Vision.

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.

""" This example shows how to list your Amazon Lookout for Vision projects. If you haven't previously created a project in the current AWS Region, the response is an empty list, however it confirms that you can call the Lookout for Vision API. """ from botocore.exceptions import ClientError import boto3 class Hello: """Hello class for Amazon Lookout for Vision""" @staticmethod def list_projects(lookoutvision_client): """ Lists information about the projects that are 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("ARN: " + project["ProjectArn"]) print() print("Done!") except ClientError as err: print(f"Couldn't list projects. \n{err}") raise def main(): session = boto3.Session(profile_name="lookoutvision-access") lookoutvision_client = session.client("lookoutvision") Hello.list_projects(lookoutvision_client) if __name__ == "__main__": main()
  • For API details, see ListProjects in AWS SDK for Python (Boto3) API Reference.