def get_firewall_apikey(session_key):
    """Given a splunk session_key returns a clear text API Key from a splunk password container"""
    try:
        entities = entity.getEntities(['admin', 'passwords'], namespace=APPNAME, owner='nobody', sessionKey=session_key)
    except Exception as e:
        exit_with_error("Could not get %s credentials from splunk. Error: %s" % (APPNAME, str(e)))
    for i, c in entities.items():
        if c['username'] == 'firewall_api_key':
            return c['clear_password']
    raise NoCredentialsFound
dataset/ETHPy150Open PaloAltoNetworks/SplunkforPaloAltoNetworks/bin/lib/common.py/get_firewall_apikey/original