Error scraping info from Openweathermap
Posted: Tuesday 20 June 2017 18:24
I wanted to scrape info from the Api of Openweathermap.
But I only get errors.
Here's what I did:
Which returns the error:
Am I missing something?
Is there anyone who can put me on the right track?
Thanks in advance.
Cheers, Hans
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)
Code: Select all
attempt to index field 'list' (a nil value)
Is there anyone who can put me on the right track?
Thanks in advance.
Cheers, Hans