def get_rhic(rhic_id): c = config.get_rhic_serve_config_info() api = '/api/rhic/503e31fdd9c1416fd0000003/' #status, data = request(c['host'], c['port'], api, c['user'], c['passwd'], False) data = request(c['host'], c['port'], api, c['user'], c['passwd'], False) return data
def get_account(): c = config.get_rhic_serve_config_info() api = '/api/account/' #status, data = request(c['host'], c['port'], api, c['user'], c['passwd'], False) data = request(c['host'], c['port'], api, c['user'], c['passwd'], False) return data
def get_all_rhics(): c = config.get_rhic_serve_config_info() status, data = request(c['host'], c['port'], '/api/rhic/', c['user'], c['passwd'], False) if status == 200: return data raise Exception(status, data)
def get_rhic_details(RHIC): id = getRHICdata(RHIC) c = config.get_rhic_serve_config_info() if id: api = '/api/rhic/' + id + '/' #status, data = request(c['host'], c['port'], api, c['user'], c['passwd'], False) data = request(c['host'], c['port'], api, c['user'], c['passwd'], False) return data
def getRHICdata(RHIC): c = config.get_rhic_serve_config_info() api = '/api/rhic/' data = request(c['host'], c['port'], api, c['user'], c['passwd'], False) all_rhics = data #all_rhics = json.loads(data) my_rhics = [] for rhic in all_rhics: if rhic['uuid'] == RHIC: return rhic['id']
def getRHIC_in_account(): c = config.get_rhic_serve_config_info() api = '/api/account/' #status, data = request(c['host'], c['port'], api, c['user'], c['passwd'], False) data = request(c['host'], c['port'], api, c['user'], c['passwd'], False) account_doc = data[0] print(account_doc) account_id = account_doc[0]['account_id'] api = '/api/rhic/' data = request(c['host'], c['port'], api, c['user'], c['passwd'], False) #all_rhics = json.loads(data[0]) all_rhics = data my_rhics = [] for rhic in all_rhics: if rhic['account_id'] == account_id: my_rhics.append(rhic['uuid']) return my_rhics
def get_contract(api): c = config.get_rhic_serve_config_info() #status, data = request(c['host'], c['port'], api, c['user'], c['passwd'], False) data = request(c['host'], c['port'], api, c['user'], c['passwd'], False) return data