From af34061aec4f01c8540337f0ba5a71a063fffed9 Mon Sep 17 00:00:00 2001 From: sakurasyaron Date: Tue, 31 Oct 2017 11:49:04 +0530 Subject: [PATCH] Update acitoolkit.py The code fails when we try the following: phydms = aci.PhysDomain.get(session) since we get an empty list for ret.json()['imdata'] in one of the elements in the loop. this fix will eliminate that error by assigning an empty dictionary if the list is empty. --- acitoolkit/acitoolkit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acitoolkit/acitoolkit.py b/acitoolkit/acitoolkit.py index 51427f7e..ccfd73f2 100755 --- a/acitoolkit/acitoolkit.py +++ b/acitoolkit/acitoolkit.py @@ -5873,7 +5873,7 @@ def get_network_from_apic(self, session): query_url = ('/api/mo/uni/phys-' + self.name + '.json?query-target=subtree&target-subtree-class=' + ac) ret = session.get(query_url) data_pool = ret.json()['imdata'] - data_pool = data_pool[0] + data_pool = data_pool[0] if len(data_pool) else {} if ac in data_pool: tDn = data_pool[ac]['attributes']['tDn'] mode = tDn.split("-")[-1]