I'm trying to use the python-ambariclient with IBM Analytics Engine:
$ pip install --quiet python-ambariclient
Then
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse
import json
vcap = json.load(open('vcap.json'))
USER = vcap['cluster']['user']
PASSWORD = vcap['cluster']['password']
AMBARI_URL = vcap['cluster']['service_endpoints']['ambari_console']
CLUSTER_ID = vcap['cluster']['cluster_id']
url = urlparse(AMBARI_URL)
HOST = url.hostname
PORT = url.port
from ambariclient.client import Ambari
ambari = Ambari(HOST, port=PORT, username=USER, password=PASSWORD)
for cluster in ambari.clusters:
print('> ' + cluster.cluster_name)
However, I'm getting a connection issue:
ConnectionError: HTTPConnectionPool(host='XXXXXX.bi.services.us-south.bluemix.net', port=9443): Max retries exceeded with url: /api/v1/clusters (Caused by ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)))
I was missing the protocol:
The full code: