Je l'ai fait sur la base de Create HTTP Get Box.
L'API est cette API météo. http://weather.livedoor.com/forecast/webservice/json/v1?city=200010
class MyClass(GeneratedClass):
def __init__(self):
GeneratedClass.__init__(self)
def onLoad(self):
#put initialization code here
pass
def onUnload(self):
#put clean-up code here
pass
def onInput_onStart(self, url):
import urllib2, json
api = "http://weather.livedoor.com/forecast/webservice/json/v1?city=200010"
r = urllib2.urlopen(api)
root = json.loads(r.read())
self.onStopped(root['title'].encode('utf8'))
Recommended Posts