From e55f34a1c2b2dd154235ff6244eca071ee4b4d00 Mon Sep 17 00:00:00 2001 From: Sambuddha Chatterjee Date: Tue, 12 Mar 2024 14:55:03 +0530 Subject: [PATCH] Making some more changes to mitigate error --- app.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app.py b/app.py index d119469..4418fc8 100644 --- a/app.py +++ b/app.py @@ -37,6 +37,12 @@ # Send the API request and parse the JSON response response = requests.get(url, params=params) data_IBM = js.loads(response.text) +st.write(data_IBM.keys()) +if 'Time Series (Daily)' in data_IBM: + daily_data = data_IBM['Time Series (Daily)'] +else: + print("Error: 'Time Series (Daily)' key not found in data") + # Handle the missing key here (e.g., display an error message, try a different source) #st.write(data_IBM) try: daily_data = data_IBM['Time Series (Daily)']