weather/noaa: Adapt to server API changes
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
- Launch
plasmoidviewer -a org.kde.plasma.weather
- In the weather applet, select a location withing the US, using the NOAA provider and wait
- 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