Hi @diwaly2019,
Create app setup page (setup.xml in /default) that accepts user credentials and update python script to read credentials:
setup.xml
<setup>
<block title="Add new credentials" endpoint="storage/passwords" entity="_new">
<input field="name">
<label>Username</label>
<type>text</type>
</input>
<input field="password">
<label>Password</label>
<type>password</type>
</input>
</block>
</setup>
Python code:
import json
import splunk.entity as entity
if __name__ == "__main__":
app = "<app_name>where_credentials_stored"
try:
settings = json.loads(sys.stdin.read())
config = settings['configuration']
entities = entity.getEntities(['admin', 'passwords'], namespace=app, owner='nobody', sessionKey=settings['session_key'])
i, c = entities.items()[0]
user, password = c['username'], c['clear_password']
except Exception as e:
print >> sys.stderr, "ERROR Unexpected error: %s" % e
sys.exit(1)
Credentials are stored in passwords.conf in your app.
... View more