ashok2216 commited on
Commit
d4e4206
·
verified ·
1 Parent(s): 2f8492b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -42,12 +42,18 @@ import math
42
 
43
  # Weather API configuration
44
  # WEATHER_API_KEY = os.getenv("OPENWEATHER_API_KEY")
 
45
  WEATHER_API_KEY = "80abcb4987dcd87229eb4f36d2a2e7e2"
 
 
 
46
  WEATHER_API_URL = "https://api.openweathermap.org/data/2.5/weather"
47
 
48
  @st.cache_data(ttl=1800) # Cache for 30 minutes
49
  def fetch_weather_data(lat, lon):
50
  """Fetch weather data for a specific location"""
 
 
51
  try:
52
  params = {
53
  'lat': lat,
 
42
 
43
  # Weather API configuration
44
  # WEATHER_API_KEY = os.getenv("OPENWEATHER_API_KEY")
45
+ # WEATHER_API_KEY = os.getenv("OPENWEATHER_API_KEY")
46
  WEATHER_API_KEY = "80abcb4987dcd87229eb4f36d2a2e7e2"
47
+
48
+ if not WEATHER_API_KEY:
49
+ st.warning("Please set OPENWEATHER_API_KEY environment variable to show weather data")
50
  WEATHER_API_URL = "https://api.openweathermap.org/data/2.5/weather"
51
 
52
  @st.cache_data(ttl=1800) # Cache for 30 minutes
53
  def fetch_weather_data(lat, lon):
54
  """Fetch weather data for a specific location"""
55
+ if not WEATHER_API_KEY:
56
+ return None
57
  try:
58
  params = {
59
  'lat': lat,