also error out if item is not found

This commit is contained in:
j 2012-03-18 14:28:54 +01:00
parent a467d6b0af
commit bedfb59c7f

View file

@ -547,13 +547,19 @@ class Client(object):
print "invalid layer name, choices are: ", ', '.join(layers) print "invalid layer name, choices are: ", ', '.join(layers)
sys.exit(1) sys.exit(1)
for s in ox.srt.load(filename): for s in ox.srt.load(filename):
self.api.addAnnotation({ r = self.api.addAnnotation({
'item;': item, 'item;': item,
'layer;': layer, 'layer;': layer,
'in': s['in'], 'in': s['in'],
'out': s['out'], 'out': s['out'],
'value': s['value'], 'value': s['value'],
}) })
if r['status']['code'] == 403:
print 'permission deinied'
sys.exit(1)
elif r['status']['code'] == 404:
print 'item not found'
sys.exit(1)
class API(ox.API): class API(ox.API):
__name__ = 'pandora_client' __name__ = 'pandora_client'