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?
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;.
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.
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.
mc = boto3.client('ssm') try: ... except mc.exceptions.ParameterNotFound: ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With