def load_locations_from_environ(): location_mapping = {} for env_key, value in environ.items(): if 'COLLECTION_MAP_ID' in env_key: map_file_id = environ.get(env_key.replace('MAP_ID', 'FILE_ID')) location_mapping[value] = Location.load_locations_from_collection( value, file_id=map_file_id) return location_mapping
def google_mapping_to_csv(map_id): locations = Location.load_locations_from_collection(map_id) rows = [Location.SUPPORTED_ATTRIBUTES] for location in locations: rows.append(location.to_row()) with open(f'{map_id}.csv', 'w') as outfile: writer = csv.writer(outfile) writer.writerows(rows)