Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I import the boto3 ssm ParameterNotFound exception?

Tags:

I would like to import the exception that occurs when a boto3 ssm parameter is not found with get_parameter. I'm trying to add some extra ssm functionality to the moto library, but I am stumped at this point.

>>> import boto3 >>> ssm = boto3.client('ssm') >>> try:         ssm.get_parameter(Name='not_found')     except Exception as e:         print(type(e)) <class 'botocore.errorfactory.ParameterNotFound'> >>> from botocore.errorfactory import ParameterNotFound ImportError: cannot import name 'ParameterNotFound' >>> import botocore.errorfactory.ParameterNotFound ModuleNotFoundError: No module named 'botocore.errorfactory.ParameterNotFound'; 'botocore.errorfactory' is not a package 

However, the Exception cannot be imported, and does not appear to exist in the botocore code. How can I import this exception?

like image 879
zalpha314 Avatar asked Sep 05 '17 20:09

zalpha314


People also ask

What is SSM Boto3?

A low-level client representing Amazon Simple Systems Manager (SSM) Amazon Web Services Systems Manager is a collection of capabilities to help you manage your applications and infrastructure running in the Amazon Web Services Cloud;.

What is from Botocore exceptions import ClientError?

The most common botocore exception you'll encounter is ClientError . This is a general exception when an error response is provided by an AWS service to your Boto3 client's request.

What is SSM in Python?

SSM Parameter Store is similar to Secret Manager, but it also allows you to store non-secret things. Below is the description of the service from AWS. AWS Systems Manager Parameter Store provides secure, hierarchical storage for configuration data management and secrets management.


1 Answers

mc = boto3.client('ssm') try:   ... except mc.exceptions.ParameterNotFound:   ... 
like image 102
gladiatr72 Avatar answered Sep 17 '22 12:09

gladiatr72