This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Scrit HTTP request timeout
#2
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
Reply


Messages In This Thread
Scrit HTTP request timeout - by emme - 28.07.2021, 08:18
RE: Scrit HTTP request timeout - by benanderson_475 - 29.07.2021, 01:38
RE: Scrit HTTP request timeout - by emme - 30.07.2021, 08:28

Forum Jump: