@@ -21,28 +21,32 @@ def process_collection(headers, args, func):
2121 # Retrieve all my groups
2222 g_response = json .loads (utils .rest_api .groups (headers , args ["api_ver" ]))
2323
24- # Iterate to the named group
25- for group in g_response ['data' ]:
26- if group ['attributes' ]['name' ] == args ['grp_name' ]:
27- go_pagination = None
28- while True :
29- go_response = json .loads (utils .rest_api .group_orgs (headers , args ["api_ver" ], group , go_pagination ))
30-
31- # Iterate to the named Org
32- for org in go_response ['data' ]:
33- if org ['attributes' ]['name' ] == args ["org_name" ]:
34-
35- # Find the collection id
36- collection_id = find_collection (headers , args , org )
37-
38- # Do the collection process within the passed function
39- func (headers , args , org , collection_id )
40-
41- # Next page?
42- go_pagination = next_page (go_response )
43- if go_pagination is None :
44- break
45-
24+ try :
25+ # Iterate to the named group
26+ for group in g_response ['data' ]:
27+ if group ['attributes' ]['name' ] == args ['grp_name' ]:
28+ go_pagination = None
29+ while True :
30+ go_response = json .loads (utils .rest_api .group_orgs (headers , args ["api_ver" ], group , go_pagination ))
31+
32+ # Iterate to the named Org
33+ for org in go_response ['data' ]:
34+ if org ['attributes' ]['name' ] == args ["org_name" ]:
35+
36+ # Find the collection id
37+ collection_id = find_collection (headers , args , org )
38+
39+ # Do the collection process within the passed function
40+ func (headers , args , org , collection_id )
41+
42+ # Next page?
43+ go_pagination = next_page (go_response )
44+ if go_pagination is None :
45+ break
46+ except Exception :
47+ print ("GET call to /groups API returned no 'data'" )
48+ print (json .dumps (g_response , indent = 4 ))
49+ return
4650
4751
4852def find_collection (headers , args , org ):
0 commit comments