We have solved the problem of obtaining the geolocation from the IP address in this chapter. As the business requested, we also need to know the current temperature given a geolocation.
Go to the OpenWeatherMap page at: https://openweathermap.org/. Register for a free plan to obtain your free API key, that key is needed to access the free API.
Create a file called OpenWeather.java
in the src/main/java/treu/extractors
directory with the following contents:
package treu.extractors; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import doubloon.extractors.OpenExchange; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.logging.Level; import java.util.logging.Logger; public class OpenWeather { private static final String API_KEY = "API_KEY_VALUE"; //1 protected...