Python Forum
need some help to do Vault authentication using python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: need some help to do Vault authentication using python (/thread-25917.html)



need some help to do Vault authentication using python - dspy9 - Apr-15-2020

My code is working good if hardcode username, password. But i have to use Vault getmysecret authentication. Can anyone advise how i can use in python.

def call_api_get_total_record_count(url, username, password):
response = requests.get(url, auth=(username, password), headers=headers, params=parameters)

Following is the response i am getting from vault:
{{\"request_id\":\"dbfea663-af74-15d1-60e3-41289f53be00\",\"lease_id\":\"\",\"renewable\":false,\"lease_duration\":28800,\"data\":{\"APPNAME_PASSWORD\":\"XXXXXXX\",\"APPNAME_USERNAME\":\"XXXXX\"},\"wrap_info\":null,\"warnings\":null,\"auth\":null}\n\r\n}
Please let me know if i can use any python library to accumaulate request_id vault_token instead username and password.