Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -510,14 +510,26 @@ def show_weather_info(data):
|
|
| 510 |
st.session_state.weather_data = new_data
|
| 511 |
st.session_state.last_api_call = datetime.utcnow().timestamp()
|
| 512 |
st.rerun()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 513 |
with col4:
|
| 514 |
network_ok = check_network_status()
|
| 515 |
if not network_ok:
|
| 516 |
-
status_color = "#FF0000"
|
| 517 |
status_text = "λ€νΈμν¬ μ°κ²° μμ"
|
| 518 |
else:
|
| 519 |
-
|
| 520 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 521 |
|
| 522 |
# API μν νμλ₯Ό μν κ³ μ ν ν΄λμ€λ₯Ό μ¬μ©
|
| 523 |
st.markdown("""
|
|
|
|
| 510 |
st.session_state.weather_data = new_data
|
| 511 |
st.session_state.last_api_call = datetime.utcnow().timestamp()
|
| 512 |
st.rerun()
|
| 513 |
+
# session_stateμ API μ€ν¨ μκ° μ μ₯μ μν λ³μ μΆκ°
|
| 514 |
+
if 'api_failed_time' not in st.session_state:
|
| 515 |
+
st.session_state.api_failed_time = None
|
| 516 |
+
|
| 517 |
with col4:
|
| 518 |
network_ok = check_network_status()
|
| 519 |
if not network_ok:
|
| 520 |
+
status_color = "#FF0000"
|
| 521 |
status_text = "λ€νΈμν¬ μ°κ²° μμ"
|
| 522 |
else:
|
| 523 |
+
if not st.session_state.api_failed:
|
| 524 |
+
status_color = "#00AA00"
|
| 525 |
+
status_text = "API μ μ"
|
| 526 |
+
st.session_state.api_failed_time = None
|
| 527 |
+
else:
|
| 528 |
+
status_color = "#FF0000"
|
| 529 |
+
if st.session_state.api_failed_time is None:
|
| 530 |
+
st.session_state.api_failed_time = datetime.now()
|
| 531 |
+
failed_time = st.session_state.api_failed_time.strftime('%Y-%m-%d %H:%M')
|
| 532 |
+
status_text = f"API μλ΅ μμ({failed_time} λ°μ)"
|
| 533 |
|
| 534 |
# API μν νμλ₯Ό μν κ³ μ ν ν΄λμ€λ₯Ό μ¬μ©
|
| 535 |
st.markdown("""
|