# HG changeset patch # User Matti Hamalainen # Date 1506418704 -10800 # Node ID 1f16d27c571dc11b35b481e8b44a3800133c2ff8 # Parent 19fe8ef0a902471ea6203dba54102617c6db154f fetch_weather: Make tiehallinto API urls configurable. diff -r 19fe8ef0a902 -r 1f16d27c571d fetch_weather.pl --- a/fetch_weather.pl Tue Sep 26 12:33:38 2017 +0300 +++ b/fetch_weather.pl Tue Sep 26 12:38:24 2017 +0300 @@ -44,6 +44,8 @@ "outfile" => "", "tiehallinto_static_meta" => "tiehallinto.meta", "http_user_agent" => "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 6.0) Opera 10.63 [en]", + "tiehallinto_rw_url" => "http://tie.digitraffic.fi/sujuvuus/ws/roadWeather", + "tiehallinto_meta_url" => "http://tie.digitraffic.fi/api/v1/metadata/weather-stations", ); @@ -352,7 +354,7 @@ ### if (opt_chk_bool("opt_tiehallinto")) { - my $uri = "http://tie.digitraffic.fi/sujuvuus/ws/roadWeather"; + my $uri = opt_get("tiehallinto_rw_url"); print STDERR "Fetching Tiehallinto road weather data from ".$uri."\n" if (opt_get_int("debug") > 0); my $res = fetch_http($uri); if ($res->code >= 200 && $res->code <= 201) @@ -385,7 +387,7 @@ my $meta_str; if ($fetch_meta || opt_chk_book("force_update")) { - my $uri = "http://tie.digitraffic.fi/api/v1/metadata/weather-stations"; + my $uri = opt_get("tiehallinto_meta_url"); print STDERR "Fetching Tiehallinto static meta data from $uri\n" if (opt_get_int("debug") > 1); my $res = fetch_http($uri); die("Failed to fetch $uri data.\n") unless ($res->code <= 200 && $res->code <= 201);