def test_normalize_key(): inkey = ' a b cde ' outkey = normalize_key(inkey) assert (outkey == 'abcde') inkey = 'AT&T & Friends' outkey = normalize_key(inkey) assert (outkey == 'attfriends') inkey = 'saco34bogotá' outkey = normalize_key(inkey) assert (outkey == 'saco34bogotá')
def get_row_search_key(cls, row, result_keys): ''' Returns search key for provided row. Search key is based on provided result_keys array. ''' row_keys = [ row['meta'][key] for key in result_keys if key in row['meta']] return normalize_key(''.join(row_keys))
def get(self, location_id): """ Get information for a Location """ location_id = normalize_key(location_id) results = DATA.get_location_info(location_id) return results
def test_normalize_key(): ''' Test normalizing a key ''' inkey = ' a b cde ' outkey = normalize_key(inkey) assert outkey == 'abcde' inkey = 'AT&T & Friends' outkey = normalize_key(inkey) assert outkey == 'attfriends' inkey = 'saco34bogotá' outkey = normalize_key(inkey) assert outkey == 'saco34bogotá'
def get_row_search_key(cls, row, result_keys): ''' Returns search key for provided row. Search key is based on provided result_keys array. ''' row_keys = [ row['meta'][key] for key in result_keys if key in row['meta'] ] return normalize_key(''.join(row_keys))
def get(self): """ Search clients for a given query """ args = search_arguments.parse_args(request) asn_query = normalize_key(args.get('q')) search_filter = get_filter(args) results = SEARCH.get_search_results('clients', asn_query, search_filter) return results
def get(self, location_id): """ Get Locations matching a query """ args = TYPE_ARGUMENTS.parse_args(request) location_id = normalize_key(location_id) results = DATA.get_location_children(location_id, args.get('type')) return results
def get(self, location_id, client_isp_id): """ Get info for a particular Location + Client """ location_id = normalize_key(location_id) results = DATA.get_location_client_isp_info(location_id, client_isp_id) return results
def get(self, location_id): """ Get Locations matching a query """ args = type_arguments.parse_args(request) location_id = normalize_key(location_id) results = DATA.get_location_children(location_id, args.get('type')) return results
def get(self): """ Search for Servers matching a query. """ args = SEARCH_ARGUMENTS.parse_args(request) search_filter = get_filter(args) asn_query = normalize_key(args.get('q')) results = SEARCH.get_search_results('servers', asn_query, search_filter) return results
def get(self, location_id): """ Get list of Servers related to this Location """ location_id = normalize_key(location_id) args = include_data_arguments.parse_args(request) results = DATA.get_location_servers(location_id, args.get('data')) return results
def get(self): """ Search for Servers matching a query. """ args = search_arguments.parse_args(request) search_filter = get_filter(args) asn_query = normalize_key(args.get('q')) results = SEARCH.get_search_results('servers', asn_query, search_filter) return results
def get(self, location_id): """ Get list of Servers related to this Location """ location_id = normalize_key(location_id) args = INCLUDE_DATA_ARGUMENTS.parse_args(request) results = DATA.get_location_servers(location_id, args.get('data')) return results
def get(self): """ Get all Locations matching a query """ args = search_arguments.parse_args(request) location_query = normalize_key(args.get('q')) search_filter = get_filter(args) results = SEARCH.get_search_results('locations', location_query, search_filter) return results
def get(self): """ Get all Locations matching a query """ args = SEARCH_ARGUMENTS.parse_args(request) location_query = normalize_key(args.get('q')) search_filter = get_filter(args) results = SEARCH.get_search_results('locations', location_query, search_filter) return results
def get(self, location_id, client_id): """ Get time-based metrics for a Location + Client """ location_id = normalize_key(location_id) args = DATE_ARGUMENTS.parse_args(request) (startdate, enddate) = get_time_window(args, TIME_BINS) timebin = args.get('timebin') results = DATA.get_location_client_metrics(location_id, client_id, timebin, startdate, enddate) return results
def get(self, location_id): """ Get time-based metrics for a Location """ location_id = normalize_key(location_id) args = date_arguments.parse_args(request) (startdate, enddate) = get_time_window(args, TIME_BINS) timebin = args.get('timebin') results = DATA.get_location_metrics(location_id, timebin, startdate, enddate) return results
def get(self, location_id, client_id, server_id): """ Get time-based metrics for a Location + Client + Server """ location_id = normalize_key(location_id) args = DATE_ARGUMENTS.parse_args(request) (startdate, enddate) = get_time_window(args, TIME_BINS) timebin = args.get('timebin') results = DATA.get_location_client_server_metrics( location_id, client_id, server_id, timebin, startdate, enddate) return results