Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: unity-sds-client error response in get_collection_data #50

Open
rtapella opened this issue Dec 18, 2024 · 0 comments
Open

[Bug]: unity-sds-client error response in get_collection_data #50

rtapella opened this issue Dec 18, 2024 · 0 comments
Assignees
Labels
bug Something isn't working U-DS U-UIUX

Comments

@rtapella
Copy link
Contributor

rtapella commented Dec 18, 2024

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

@rtapella rtapella added the bug Something isn't working label Dec 18, 2024
@rtapella rtapella changed the title [Bug]: unity-sds-client error response [Bug]: unity-sds-client error response in in get_collection_data Dec 18, 2024
@rtapella rtapella changed the title [Bug]: unity-sds-client error response in in get_collection_data [Bug]: unity-sds-client error response in get_collection_data Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working U-DS U-UIUX
Projects
Status: No status
Development

No branches or pull requests

3 participants