Mercurial > hg > egg-tcls
changeset 443:1f16d27c571d
fetch_weather: Make tiehallinto API urls configurable.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 26 Sep 2017 12:38:24 +0300 |
parents | 19fe8ef0a902 |
children | fe671cd76ecc |
files | fetch_weather.pl |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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);