示例#1
0
文件: kv.py 项目: krise3k/armada
def get_env(container_id, env):
    url = '{}/env/{}/{}'.format(__get_armada_address(), container_id, env)
    response = requests.get(url)
    response.raise_for_status()
    result = response.json()
    if result['status'] != 'ok':
        raise ArmadaApiException('Armada API did not return correct status: {0}'.format(result))
    return result['value']
示例#2
0
def get_json(api_function, arguments=None, ship_name=None):
    arguments = arguments or {}
    url = __get_armada_address(ship_name) + '/' + api_function
    response = requests.get(url, params=arguments)
    response.raise_for_status()
    result = response.json()
    if result['status'] != 'ok':
        raise ArmadaApiException(
            'Armada API did not return correct status: {0}'.format(result))
    return result['result']