Home > Blockchain >  Reading credentials from AWS secret manager into python how to handle the dictionary which is sent a
Reading credentials from AWS secret manager into python how to handle the dictionary which is sent a

Time:08-18

I am fetching secrets from AWS secret manager in my notebook.

I get an output as follows in the jupyter notebook:

{
'SecretString':'{"username":"User1","password":"Pass1"}'
}

I want to parse this to store the variables as

username='User1`
password='Pass1'

How do I achieve this? Thanks!

CodePudding user response:

If you're using python, json.loads should be able to load the message as a dictionary. Then you can call the specific values through the keys, to set as variables. Make sure your the message returned is save in some variable.

 import json
 dic = json.loads(message)
 var1 = dic['Secret String']['var1']
  • Related