Spaces:
Runtime error
Runtime error
Update app.py
Browse files161 unmodified lines162163164165166167168169170171172173161 unmodified linesgithub_token = st.secrets["GitHub_Token_KUL_Margarida"]#countries = ['IT_CALA', 'IT_CNOR', 'IT_CSUD', 'IT_SARD', 'PT', 'FR']if github_token:data_dict = {}for bdz in countries:df = load_GitHub(github_token, bdz)if df is not None:data_dict[bdz] = dfelse:print("Please enter your GitHub Personal Access Token to proceed.")161 unmodified lines162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193161 unmodified linesgithub_token = st.secrets["GitHub_Token_KUL_Margarida"]#countries = ['IT_CALA', 'IT_CNOR', 'IT_CSUD', 'IT_SARD', 'PT', 'FR']@st.cache_data(show_spinner=False)def load_all_from_github(github_token, countries, period_key):"""Fetch all zones’ CSVs from GitHub and return as dict."""data = {}for bdz in countries:df = load_GitHub(github_token, bdz)if df is not None:data[bdz] = dfreturn data# in your main script, _before_ you do the for-loopnow = datetime.now(tz)if now.minute >= 15:block_start = now.replace(minute=0, second=0, microsecond=0)else:block_start = (now - timedelta(hours=1)).replace(minute=0, second=0, microsecond=0)# turn it into a simple string keyperiod_key = block_start.strftime("%Y-%m-%d-%H")if github_token:data_dict = load_all_from_github(github_token, countries, period_key)else:st.error("Please enter your GitHub Personal Access Token to proceed.")st.stop()else:print("Please enter your GitHub Personal Access Token to proceed.")
app.py+23-3