File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -179,15 +179,18 @@ def get_locations(objects):
179
179
try :
180
180
with urllib .request .urlopen (req , timeout = TIMEOUT ) as resp :
181
181
data = json .load (resp )
182
+ assert len (data ["objects" ]) == len (
183
+ indexes
184
+ ), f"received { len (data )} objects, expected { len (indexes )} "
185
+ for i , resp in zip (indexes , data ["objects" ]):
186
+ ret [i ] = f'{ resp ["oid" ]} { resp ["actions" ]["download" ]["href" ]} '
187
+ return ret
182
188
except urllib .error .URLError as e :
183
189
warn (f"encountered { type (e ).__name__ } { e } , ignoring endpoint { endpoint .name } " )
184
190
continue
185
- assert len (data ["objects" ]) == len (
186
- indexes
187
- ), f"received { len (data )} objects, expected { len (indexes )} "
188
- for i , resp in zip (indexes , data ["objects" ]):
189
- ret [i ] = f'{ resp ["oid" ]} { resp ["actions" ]["download" ]["href" ]} '
190
- return ret
191
+ except KeyError :
192
+ warn (f"encountered malformed response, ignoring endpoint { endpoint .name } :\n { json .dumps (data , indent = 2 )} " )
193
+ continue
191
194
raise NoEndpointsFound
192
195
193
196
You can’t perform that action at this time.
0 commit comments