def updateItem(item): data = item.typeItem.state url = item.typeItem.link addon_util.log_debug("updateItem request url : [%s] state:[%s]" %(url, item.typeItem.state)) req = urllib2.Request(url, data, {'Content-Type': 'text/plain'}) f = urllib2.urlopen(req) response = f.read() addon_util.log_debug("updateItem response [%s]" %(response)) f.close()
def updateItem(item): data = item.typeItem.state url = item.typeItem.link addon_util.log_debug("updateItem request url : [%s] state:[%s]" % (url, item.typeItem.state)) req = urllib2.Request(url, data, {'Content-Type': 'text/plain'}) f = urllib2.urlopen(req) response = f.read() addon_util.log_debug("updateItem response [%s]" % (response)) f.close()
def getJsonItem(item): global host, port url = 'http://' + host + ':' + port + '/rest/items/' + item + '?type=json' addon_util.log_debug("getJsonItem url : [%s]" % (url)) return getJson(url)
def getJsonSiteMap(host, port, name, id): url = 'http://' + host + ':' + port + '/rest/sitemaps/' + name + '/' + id + '?type=json' addon_util.log_debug("getJsonSiteMap url : [%s]" % (url)) return getJson(url)
def getJson(url): json_string = urllib2.urlopen(url).read() data = json.loads(json_string) addon_util.log_debug("getJson json_string : [%s]" % (json_string)) return data
def getJsonItem(item) : global host,port url = 'http://'+host+':'+port+'/rest/items/'+item+'?type=json' addon_util.log_debug("getJsonItem url : [%s]" %(url)) return getJson(url)
def getJsonSiteMap(host, port, name, id): url = 'http://'+host+':'+port+'/rest/sitemaps/'+name+'/'+id+'?type=json' addon_util.log_debug("getJsonSiteMap url : [%s]" %(url)) return getJson(url)
def getJson(url) : json_string = urllib2.urlopen(url).read() data = json.loads(json_string) addon_util.log_debug("getJson json_string : [%s]" %(json_string)) return data