@@ -30,10 +30,11 @@ local setmetatable = setmetatable
30
30
local function worker (args )
31
31
local weather = {}
32
32
local args = args or {}
33
+ local APPID = args .APPID or 1 -- mandatory
33
34
local timeout = args .timeout or 900 -- 15 min
34
35
local timeout_forecast = args .timeout or 86400 -- 24 hrs
35
- local current_call = " curl -s 'http://api.openweathermap.org/data/2.5/weather?id=%s&units=%s&lang=%s'"
36
- local forecast_call = " curl -s 'http://api.openweathermap.org/data/2.5/forecast/daily?id=%s&units=%s&lang=%s&cnt=%s'"
36
+ local current_call = " curl -s 'http://api.openweathermap.org/data/2.5/weather?id=%s&units=%s&lang=%s&APPID=%s '"
37
+ local forecast_call = " curl -s 'http://api.openweathermap.org/data/2.5/forecast/daily?id=%s&units=%s&lang=%s&cnt=%s&APPID=%s '"
37
38
local city_id = args .city_id or 0 -- placeholder
38
39
local units = args .units or " metric"
39
40
local lang = args .lang or " en"
@@ -83,7 +84,7 @@ local function worker(args)
83
84
end
84
85
85
86
function weather .forecast_update ()
86
- local cmd = string.format (forecast_call , city_id , units , lang , cnt )
87
+ local cmd = string.format (forecast_call , city_id , units , lang , cnt , APPID )
87
88
async .request (cmd , function (f )
88
89
local pos , err
89
90
weather_now , pos , err = json .decode (f , 1 , nil )
@@ -112,7 +113,7 @@ local function worker(args)
112
113
end
113
114
114
115
function weather .update ()
115
- local cmd = string.format (current_call , city_id , units , lang )
116
+ local cmd = string.format (current_call , city_id , units , lang , APPID )
116
117
async .request (cmd , function (f )
117
118
local pos , err
118
119
weather_now , pos , err = json .decode (f , 1 , nil )
0 commit comments