2013-02-26, 17:48
Hi all,
i'm trying to make a plugin that will retrieval some data from a json. The main function of the plugin will be to control a vera box (home automation). All i want is to put all the device and scene in a list and be able to send url with id to control the vera. Vera have a json function and i'm able to pull information from python script. Here the simple code:
With this code i'm able to print all the information that i want.
I will use the urllib2 function for the xbmc but in my python software, urllib2 is not installed.
Thanks and sorry for the newbie thing but it's been a while that i'm on it but without any success.
i'm trying to make a plugin that will retrieval some data from a json. The main function of the plugin will be to control a vera box (home automation). All i want is to put all the device and scene in a list and be able to send url with id to control the vera. Vera have a json function and i'm able to pull information from python script. Here the simple code:
Code:
import urllib.request
import json
url = 'http://192.168.2.19:3480/data_request?id=sdata'
data = urllib.request.urlopen(url).read().decode("utf-8")
info = json.loads(data)
results = info['devices']
for r in results:
print (r.get('id'))
print (r.get('name'))
print (r.get('status'))
With this code i'm able to print all the information that i want.
I will use the urllib2 function for the xbmc but in my python software, urllib2 is not installed.
Thanks and sorry for the newbie thing but it's been a while that i'm on it but without any success.