From bedfb59c7f9621d13a4c502ba25e9b9a29f107a1 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 18 Mar 2012 14:28:54 +0100 Subject: [PATCH] also error out if item is not found --- pandora_client/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index 24d9057..ddee8ee 100644 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -547,13 +547,19 @@ class Client(object): print "invalid layer name, choices are: ", ', '.join(layers) sys.exit(1) for s in ox.srt.load(filename): - self.api.addAnnotation({ + r = self.api.addAnnotation({ 'item;': item, 'layer;': layer, 'in': s['in'], 'out': s['out'], '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): __name__ = 'pandora_client'