Page 1 of 1

Error scraping info from Openweathermap

Posted: Tuesday 20 June 2017 18:24
by DutchHans
I wanted to scrape info from the Api of Openweathermap.
But I only get errors.
Here's what I did:

Code: Select all

JSON = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()
   local file=assert(io.popen('curl -s http://api.openweathermap.org/data/2.5/forecast?id=292XXXX&units=metric&APPID=XXXXXXXXXXXXXX &')) 
local raw = file:read('*all')
file:close()   
local jsonOWM = JSON:decode(raw)   
CloudCoverage=jsonOWM.list.clouds
print(CloudCoverage)
Which returns the error:

Code: Select all

attempt to index field 'list' (a nil value)
Am I missing something?
Is there anyone who can put me on the right track?

Thanks in advance.
Cheers, Hans