def get_config_as_str()

in decisionai_plugin/common/util/configuration.py [0:0]


def get_config_as_str(path):
        if path.startswith('file://'):
            with open(path[7:], 'r') as f:
                return f.read()
        elif path.startswith('http://') or path.startswith('https://'):
            r = requests.get(path)
            if r.status_code != requests.codes.ok:
                raise Exception('Configure file "{}" fetch failed, statuscode: {}, message: {}'.format(path, r.status_code, r.content))
            return r.text
        else:
            raise Exception('Configure file protocal not supported: {}'.format(path))