changeset 495:ec5f0ed99a28

fetch_weather: Move base "hardcoded" FMI url and certain parameters into undocumented configuration settings.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 23 Jan 2020 05:56:06 +0200
parents 3cf06dfc7ba8
children 0b73fd8ee4cd
files fetch_weather.pl
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/fetch_weather.pl	Thu Jan 23 05:55:04 2020 +0200
+++ b/fetch_weather.pl	Thu Jan 23 05:56:06 2020 +0200
@@ -46,8 +46,10 @@
   "http_user_agent" => "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 6.0) Opera 10.63  [en]",
   "tiehallinto_meta" => "tiehallinto.meta",
   "tiehallinto_meta_period" => 7,
-  "tiehallinto_rw_url" => "http://tie.digitraffic.fi/api/v1/data/weather-data",
-  "tiehallinto_meta_url" => "http://tie.digitraffic.fi/api/v1/metadata/weather-stations",
+  "tiehallinto_rw_url" => "https://tie.digitraffic.fi/api/v1/data/weather-data",
+  "tiehallinto_meta_url" => "https://tie.digitraffic.fi/api/v1/metadata/weather-stations",
+  "fmi_weather_base_url" => "https://opendata.fmi.fi/wfs",
+  "fmi_weather_extra_params" => "&maxlocations=300&bbox=19,59,32,75",
 );
 
 
@@ -444,12 +446,12 @@
 {
   my @fmitems = ("temperature", "humidity", "windspeedms", "winddirection", "totalcloudcover");
 
-  my $uri = "https://opendata.fmi.fi/wfs".
+  my $uri = opt_get("fmi_weather_base_url").
     "?request=getFeature".
     "&storedquery_id=fmi::observations::weather::multipointcoverage".
     "&starttime=".format_time_gmt(time() - 10*60)."&endtime=".format_time_gmt(time()).
     "&parameters=".join(",", @fmitems).
-    "&maxlocations=300&bbox=19,59,32,75";
+    opt_get("fmi_weather_extra_params");
 
   print STDERR "FMI URI: ".$uri."\n" if (opt_get_int("debug") > 0);