Configure proxy settings

Issue #9 resolved
Michael Hoffmann created an issue

Hi,

in my company I am using a proxy, how can I configure the OWM JAPIs for this proxy? My program throws an exception at the line:

if (cwd.hasResponseCode() && cwd.getResponseCode() == 200) {
...
}

The exception message:

01-29 15:50:42.497: W/System.err(13709): Error: Unable to resolve host "api.openweathermap.org": No address associated with hostname 01-29 15:50:42.498: E/OpenWeatherMapInputAdapter(13709): Catching weather was not successful, response code != 200

Comments (3)

  1. Ashutosh Kumar Singh repo owner

    Hi, the problem has been solved. Please download the 2.5.0.5 from Downloads. The latest version now supports proxy.

    You can do this: OpenWeatherMap owm = new OpenWeatherMap("API_KEY"); owm.setProxy("1.2.3.4", 8000); OR owm.setProxy("1.2.3.4", 8000, "username", "password");

    Of course, these are dummy values, which you can change as per your details. Check the javadocs for more details.

    Hope it helps. Thanks!

  2. Log in to comment