-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Describe the bug
@wphyojpl :
https://github.com/unity-sds/unity-monorepo/blob/main/libs/unity-py/unity_sds_client/services/data_service.py#L73
I think this response in unity py should check the status code and throw an error accordingly for 400s and 500s.
Currently, it throws this error
KeyError Traceback (most recent call last)
Cell In[15], line 4
1 dataManager = s.client(services.DATA_SERVICE)
2 collection_id = f"URN:NASA:UNITY:{os.environ['PROJECT']}:{os.environ['VENUE']}:QSR_10"
----> 4 cd = dataManager.get_collection_data(Collection(collection_id), limit=100)
5 for dataset in cd:
6 print(f'dataset name: {dataset.data_begin_time}')
File ~/.local/lib/python3.11/site-packages/unity_sds_client/services/data_service.py:75, in DataService.get_collection_data(self, collection, limit, filter, output_stac)
73 if output_stac:
74 return response.json()
---> 75 results = response.json()['features']
77 for dataset in results:
78 ds = Dataset(dataset['id'], collection.collection_id, dataset['properties']['start_datetime'], dataset['properties']['end_datetime'], dataset['properties']['created'], properties=dataset['properties'])
KeyError: 'features'
What did you expect?
catch 400 and 500 responses
zdgriffith
Metadata
Metadata
Labels
Type
Projects
Status
No status