Error scraping info from Openweathermap

Moderator: leecollings

Post Reply
DutchHans
Posts: 230
Joined: Friday 03 April 2015 20:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany (near dutch border)
Contact:

Error scraping info from Openweathermap

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest