Commit c0c39a54 authored by Bastien Nocera's avatar Bastien Nocera
Browse files

metno: Use compat 2.0 API

Version 1.9, which we were using, was deprecated and will be removed soon,
so migrate to the compat XML output of the v2.0 API.

Closes: #65
parent 6414276d
Pipeline #246103 passed with stage
in 3 minutes and 23 seconds
......@@ -37,7 +37,7 @@
#define XC(t) ((const xmlChar *)(t))
/* Reference for symbols at http://om.yr.no/forklaring/symbol/ */
/* Reference for symbols at https://api.met.no/weatherapi/weathericon/2.0/ */
typedef struct {
int code;
GWeatherSky sky;
......@@ -444,12 +444,12 @@ metno_start_open (GWeatherInfo *info)
if (!loc->latlon_valid)
return FALSE;
/* see the description here: https://api.met.no/ */
/* see the description here: https://api.met.no/weatherapi/locationforecast/2.0/documentation */
latstr = _radians_to_degrees_str (loc->latitude);
lonstr = _radians_to_degrees_str (loc->longitude);
url = g_strdup_printf("https://api.met.no/weatherapi/locationforecast/1.9/?lat=%s;lon=%s", latstr, lonstr);
url = g_strdup_printf("https://api.met.no/weatherapi/locationforecast/2.0/classic?lat=%s;lon=%s", latstr, lonstr);
  • Please use "&" as parameter separator. According to the HTML5 spec ";" is no longer allowed. We currently rewrite this in Varnish, but that is a temporary measure that has been running for 4 years and is likely to disappear if we change cache/load balancer.

  • Filed as #72 (closed)

Please register or sign in to reply
g_debug ("metno_start_open, requesting: %s", url);
message = soup_message_new ("GET", url);
......
  • Also, for a correct temperature you should add the height above mean sea level in the "altitude" parameter. Without this we rely on a course topography model which can be inaccurate in areas that are not flat.

  • mentioned in issue #72 (closed)

    Toggle commit list
  • mentioned in issue #73

    Toggle commit list
  • Filed as #73

    although altitude is usually not data that we have available when making those requests.

  • True, for altitude you normally need a geolocation database with place name information, unless you have access to GPS like on mobile apps. This will complicate the library greatly, but allowing it to be passed from the app should be easy enough, e.g. from a preferences pane in the GNOME applet.

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment