You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When requesting a number of files (especially using the bulk download API endpoints), it is difficult to catch exceptions and errors that may arise when calling the API because they are caught and printed rather than raised to the user. It would be great to have the option to have exceptions passed on to handle them dynamically rather than caught and printed within the package.
For example, if a call times out or returns anything besides 200 in the middle of a number of requests, it's impossible to catch that with the current setup to handle and re-try the request because the package prints and moves on. Having the option to raise exceptions and non-200s as their own exceptions (and ideally exposing information about the URL being called during the issue to re-try or otherwise handle) would be ideal. Examples from BulkDownload.py where this could be addressed are below:
ifresp.status_code!=200:
# This means something went wrong.jsonResult=resp.json()
print('Error in calling API:', resp.url)
print('Error code:', jsonResult['statusCode'])
print('Error message:', jsonResult['message'])
exceptrequests.exceptions.Timeout:
# Maybe set up for a retry, or continue in a retry loopprint('Request failed due to timeout')
exceptrequests.exceptions.TooManyRedirects:
# Tell the user their URL was bad and try a different oneprint('Request failed due to too many redirects')
exceptrequests.exceptions.RequestExceptionase:
# catastrophic error. bail.raiseSystemExit(e)
The text was updated successfully, but these errors were encountered:
When requesting a number of files (especially using the bulk download API endpoints), it is difficult to catch exceptions and errors that may arise when calling the API because they are caught and printed rather than raised to the user. It would be great to have the option to have exceptions passed on to handle them dynamically rather than caught and printed within the package.
For example, if a call times out or returns anything besides 200 in the middle of a number of requests, it's impossible to catch that with the current setup to handle and re-try the request because the package prints and moves on. Having the option to raise exceptions and non-200s as their own exceptions (and ideally exposing information about the URL being called during the issue to re-try or otherwise handle) would be ideal. Examples from BulkDownload.py where this could be addressed are below:
The text was updated successfully, but these errors were encountered: