Python Forum

Full Version: need some help to do Vault authentication using python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.