29.07.2021, 01:38
(This post was last modified: 29.07.2021, 01:39 by benanderson_475.)
Try Like this,
Code:
require('json')
local http = require('socket.http')
local OWMLINK = 'https://api.openweathermap.org/data/2.5/onecall?'
local OWMAPIKEY = ''
local OWMUNIT = 'metric'
local OWMLAT = '41.8719'
local OWMLON = '12.5674'
local OWMLANG = 'it'
local OWMEXCLUDE = 'minutely,hourly'
local OWMResponse, err= http.request( OWMLINK..'lat='..OWMLAT..'&lon='..OWMLON..'&lang='..OWMLANG..'&exclude='..OWMEXCLUDE..'&appid='..OWMAPIKEY..'&units='..OWMUNIT)
log(OWMResponse, err)
if OWMResponse then
local data = json.pdecode(OWMResponse)
log(data)
else if err then
log('ERROR :' .. err)
end
end