import json import boto3 import config class SecretsManager: def __init__(self): session = boto3.session.Session() self.client = session.client( service_name='secretsmanager', region_name=config.AWS_REGION ) self.cypress_secret_name = config.CYPRESS_SECRET_NAME def get_db_credentials(self, db_name): get_secret_value = self.client.get_secret_value( SecretId=self.cypress_secret_name ) formatted_response = json.loads(get_secret_value['SecretString']) return formatted_response['db'][db_name]