Skip to content

weather/noaa: Adapt to server API changes

Ismael Asensio requested to merge work/iasensio/weather-fix-noaa into master

Reason for the change

Recently, the weather applet has been failing to show forecast reports for the NOAA provider. This is a mix of the server rejecting some of the forecast requests and a small API change we weren't parsing correctly.

After some digging, this improves the chance of showing them right, or at least get a log when they don't.

  • Set a precision limit on the lat/lon parameters in the request to reduce the chance of the server rejecting it

  • When parsing the xml response, check for a layout-key that provides daily forecast (24h), but not only 7-days, since sometimes we also get an 8-days report

  • In case of a server error issue, parse the returned message and log it. It can help future debugging but it's not really useful or actionable to the user.

Test plan

  1. Launch plasmoidviewer -a org.kde.plasma.weather
  2. In the weather applet, select a location withing the US, using the NOAA provider and wait
  3. The forecast is retrieved and shown, or either we get a warning on the log output, similar to kde.dataengine.ion.noaa: Server error requesting forecast: "No data were found using the following inputs to DWML C executable:"

Bugs fixed

Forecast for the NOAA provider are more likely to be shown, but no guarantee if the remote server fails

Merge request reports