![]() |
|
Scrit HTTP request timeout - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Scrit HTTP request timeout (/showthread.php?tid=3491) |
Scrit HTTP request timeout - emme - 28.07.2021 Hi, Got a LM5 i.MX6 with most recent fw (20210510) and I?m experiencing a wired issue IP configuration is correct.. I can ping 8.8.8.8 and traceroute www.google.com correctly, but.. all lua script that uses socket.http library goes in timeout error. luasocket library is version 2.0.2-20210217 This of course will prevent any script to run as they are intended. Is is an issue someone else has faced and fixed? thanks Regards P.S. this is the script: Code: require('json')
local http = require('socket.http')
http.TIMEOUT = 30
local OWMLINK = 'https://api.openweathermap.org/data/2.5/onecall?'
local OWMAPIKEY = ''
local OWMUNIT = 'metric'
local OWMLAT =
local OWMLON =
local OWMLANG = 'it'
local OWMEXCLUDE = 'minutely,hourly'
OWMLINK = OWMLINK..'lat='..OWMLAT..'&lon='..OWMLON..'&appid='..OWMAPIKEY..'&units='..OWMUNIT..'&exclude='..OWMEXCLUDE
log(OWMLINK)
local OWMResponse, code, headers, status= http.request(OWMLINK)
log(code, status, headers)
if not OWMResponse then
alert('Previsioni OpenWeather: Impossibile recuperare dati')
return
end
local data = json.pdecode(OWMResponse)
if not data then
alert('Previsioni OpenWeather: Impossibile convertire dati')
return
endvariable "code" result timeut ...it is not a timeout parameter issue ![]() this is an example.. I do have the telegram notification script that doesn't work either RE: Scrit HTTP request timeout - benanderson_475 - 29.07.2021 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
endRE: Scrit HTTP request timeout - emme - 30.07.2021 thnaks... I found the issue.... I made a BAD mistake on the NAT setup on my router.... it is now working good thanks ciao M |