diff --git a/src/server.py b/src/server.py index 01fb395..81c54bd 100644 --- a/src/server.py +++ b/src/server.py @@ -115,9 +115,9 @@ async def get_terria_map_catalog_data(grid_type: Union[str, None] = Query(defaul if 'Error' in ret_val: # set the status to a server error status_code = 500 - elif 'Warning' in ret_val: - # set the status to a not found - status_code = 404 + # elif 'Warning' in ret_val: + # # set the status to a not found + # status_code = 404 else: # if there was DB error if ret_val == -1: @@ -130,9 +130,6 @@ async def get_terria_map_catalog_data(grid_type: Union[str, None] = Query(defaul # set a warning message ret_val = {'Warning': 'No data found using the filter criteria selected.'} - # set the status to a not found - status_code = 404 - except Exception: # return a failure message ret_val = {'Exception': 'Error detected trying to get the terria map catalog data.'} @@ -200,9 +197,6 @@ async def get_catalog_workbench(insertion_date: Union[str, None] = Query(default # set a warning message ret_val = {'Warning': 'No data found using the filter criteria selected.'} - # set the status to a not found - status_code = 404 - except Exception: # return a failure message ret_val = {'Exception': 'Error detected trying to get the terria map catalog workbench data.'} @@ -285,13 +279,10 @@ async def get_terria_map_catalog_data_secure(grid_type: Union[str, None] = Query # set the status to a not found status_code = 500 # check the return, no data gets a 404 return - elif ret_val['catalog'] is None: + elif 'catalog' not in ret_val: # set a warning message ret_val = {'Warning': 'No data found using the filter criteria selected.'} - # set the status to a not found - status_code = 404 - except Exception: # return a failure message ret_val = {'Exception': 'Error detected trying to get the terria map catalog data.'} @@ -392,8 +383,6 @@ async def get_terria_map_catalog_data_file(file_name: Union[str, None] = Query(d # set a warning message ret_val = {'Warning': 'No data found using the filter criteria selected.'} - # set the status to a not found - status_code = 404 else: # make the directory os.makedirs(temp_file_path) @@ -451,16 +440,10 @@ def get_station_data(station_name: Union[str, None] = Query(default=None), time_ if len(ret_val) == 0: # set the Warning message and the return status ret_val = 'Warning: No station data found using the criteria selected.' - - # set the status to a not found - status_code = 404 else: # set the error message ret_val = 'Error Invalid input. Insure that all input fields are populated.' - # set the status to a not found - status_code = 404 - except Exception: # return a failure message ret_val = 'Exception detected trying to get station data.' @@ -526,9 +509,6 @@ async def get_station_data_file(file_name: Union[str, None] = Query(default='sta # set the Warning message and the return status ret_val = 'Warning: No station data found using the criteria selected.' - # set the status to a not found - status_code = 404 - else: # make the directory os.makedirs(temp_file_path) @@ -542,9 +522,6 @@ async def get_station_data_file(file_name: Union[str, None] = Query(default='sta # set the error message ret_val = 'Error Invalid input. Insure that all input fields are populated.' - # set the status to a not found - status_code = 404 - except Exception: # return a failure message ret_val = 'Exception detected trying to get station data.' @@ -611,9 +588,6 @@ async def get_catalog_member_records(run_id: Union[str, None] = Query(default=No # return a failure message ret_val = {'Warning': 'No data found using the filter criteria selected.'} - # set the status to a data not found error - status_code = 404 - except Exception: # return a failure message ret_val = {'Error': 'Exception detected trying to get the catalog member data.'}