tos_options_dashboard
tos_options_dashboard copied to clipboard
Feature: add error reporting
the update_search function should add error reporting. Currently there is no indication of why the UI doesnt accept ticker values which can happen if the API_KEY is invalid.
def update_search(search_value, ticker_switch, value):
print ('search value',search_value, 'ticker',ticker_switch, value)
if not search_value:
print ('preventing updates')
raise PreventUpdate
if ticker_switch:
json_data = tos_search(search_value, projection='symbol-search', apiKey=API_KEY)
else:
json_data = tos_search(search_value, projection='desc-search', apiKey=API_KEY)
if 'error' in json_data:
print (f'Error in query results. Possible API key issues: json_data erturned: {json_data}')