0

My secrets manager is throwing secrets in the below format:

{"username":"uname","password":"mypassword"}

I want to extract username as password to use in psycopg2 connection string but it's not working. below is my code:

username = secret['username']
passw = secret['password']

conn = psycopg2.connect(host="hostname",port='5432',database="db", user=username, password=passw)

I see this error : [ERROR] TypeError: string indices must be integers

how to get username, password and host form secrets manager to use in psycopg2 connection string?

Rick
  • 1,392
  • 1
  • 21
  • 52

0 Answers0