class WeatherWebApi {

    public List<LocationInfo> search(String query) {
        String path = HOST + String.format(PATH_SEARCH, query, WEATHER_KEY);
        System.out.println(path);
        List<LocationInfo> locations = new ArrayList<>();
        try(
            InputStream in = new URL(path).openStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(in)))
        {
            String line;
            while ((line = reader.readLine()) != null) {
                if(line.startsWith("#")) continue;
                locations.add(LocationInfo.valueOf(line));
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return locations;
    }

}