Exemple #1
0
def index(portiaConfig):

    endpoint = '/pipeline/axioms'
    response = utils.httpGetRequest(portiaConfig, endpoint)

    if response.status_code == 200:

        d = json.loads(response.text)
        if portiaConfig['debug']:
            print('[portia-debug]: {0}'.format(d))

        return d

    else:

        d = json.loads(response.text)
        raise Exception('couldn\'t list axioms: {0}'.format(d['message']))
Exemple #2
0
def show(portiaConfig, phaseName):

    endpoint = '/pipeline/phases/{0}'.format(phaseName)
    response = utils.httpGetRequest(portiaConfig, endpoint)

    if response.status_code == 200:

        d = json.loads(response.text)
        if portiaConfig['debug']:
            print('[portia-debug]: {0}'.format(d))

        return d

    else:

        d = json.loads(response.text)
        raise Exception('couldn\'t retrieve data: {0}'.format(d['message']))
Exemple #3
0
def show(portiaConfig, axiomName, params=False):

    if params == False:
        endpoint = '/pipeline/axioms/{0}'.format(axiomName)
    else:
        endpoint = '/pipeline/axioms/{0}/params'.format(axiomName)

    response = utils.httpGetRequest(portiaConfig, endpoint)

    if response.status_code == 200:

        d = json.loads(response.text)
        if portiaConfig['debug']:
            print('[portia-debug]: {0}'.format(d))

        return d

    else:

        d = json.loads(response.text)
        raise Exception('couldn\'t show axiom: {0}'.format(d['message']))