### ------- OPEN THE CONFIG FILE and INSTANTIATE API ------- f = open('config.yml') params = yaml.load(f) f.close() my_host = params['hosts'][host]['host'] my_secret = params['hosts'][host]['secret'] my_token = params['hosts'][host]['token'] looker = LookerApi(host=my_host, token=my_token, secret=my_secret) ### ------- GET AND PRINT THE LOOK ------- space_data = looker.get_all_spaces(fields='id, parent_id, name') data = looker.get_content_validation() host_url = my_host[:my_host.index(":19999")] broken_content = data['content_with_errors'] # pprint(broken_content) output = [] for item in broken_content: if item['dashboard'] is None: type = 'look' else: type = 'dashboard' id = item[type]['id']
f.close() my_host = params['hosts'][host]['host'] my_secret = params['hosts'][host]['secret'] my_token = params['hosts'][host]['token'] looker = LookerApi(host=my_host, token=my_token, secret=my_secret) # Pandas has a weird bug where it incorrectly calculates the output width and cuts off columns... pd.set_option('display.expand_frame_repr', False) # Create a dictionary of spaces:content_meta_data_ids so we can iterate through and check the accesses to those spaces spaces = \ looker.get_all_spaces(fields='id,is_personal,creator_id,is_personal_descendant,content_metadata_id,name' ) spaces_content_metadata_ids = {} spacejson = json.loads(json.dumps(spaces)) # List of spaces that are sub spaces of users so we can include/exclude as needed personal_descendant_ids = [] non_personal_descendant_ids = [] # Need to remove spaces that are is_personal_descendant, because we can't be auditing spaces that are sub-spaces of a user's personal space either for space in spacejson: if space['is_personal_descendant'] == False and space['is_personal' ] == False and space['id'] != 'lookml' and space['name'] \