Closed Jacob-Stevens-Haas closed 10 months ago
The bug has been fixed in the backend. Could you double check to see if the issue could be closed?
It works and causes the exception in the proper place. However, I still think the error should be a ValueError
(as noted in (this SO post)[https://stackoverflow.com/a/30855949/534674]. the else
exception could just use Response.raise_for_status()
Yeah, I agree. Pylint gave me a lot of broad-exception-caught warning. These exceptions could be narrowed down to give a more meaningful error. I am not experienced in dealing with Exceptions. Do you want to create a new issue for this enhancement?
(Created from email ticket)
Description
When requesting data products during an interval when no data exists, the
onc
package raises aTypeError: sting indices must be integers
Expected Behavior
Either raise a more meaningful error, return a request dictionary with a null id
Actual behavior/MWE:
MWE:
Raises:
Discussion:
The error results because
_OncDelivery.requestDataProduct()
dispatches toOncService.doRequest()
(link)_OncService.doRequest()
gets a HTTP200 response with json content that is just a string, in violation of the API (link)_OncDelivery.requestDataProduct()
..._OncService._printProductRequest()
_OncService._printProductRequest()
then queriesresponse['dpRequestId']
, butresponse
is a string, raising theTypeError
(link)The API is clear that the server should be returning HTTP 400 with an error code of 33 and the message "No data found for data search with given parameters". If it's easier to fix the client library rather than the server, I could PR a stopgap where
doRequest
checks the json response for a top-level string rather than a dict, and raises aValueError
appropriately. Thoughts?