Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- context.getLogger().log("\nfunction-name: " + context.getFunctionName());
- context.getLogger().log("\ncity: " + input.getCity());
- Client client = ClientBuilder.newClient();
- WebTarget webTarget
- = client.target("https://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=555852debfe15e7053e83ba408d23e2f");
- Invocation.Builder invocationBuilder
- = webTarget.request(MediaType.APPLICATION_JSON);
- WeatherResponse response
- = invocationBuilder.get(WeatherResponse.class);
- for(Weather w: response.getWeather()) {
- System.out.println("weather detail:" + w.getDescription());
- }
- context.getLogger().log("\nreturning: " + response);
- context.getLogger().log("\n\n");
- return new HandlerResponse(response);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement