aromidvar1355 commited on
Commit
7a6e135
·
verified ·
1 Parent(s): 741c573

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -12,6 +12,9 @@ from datetime import datetime, timedelta
12
  import pytz
13
 
14
 
 
 
 
15
  # --- API KEYS ---
16
  OPENWEATHER_API_KEY = "c6c267b301a145ddec9b381e7d87a5af"
17
  STORMGLASS_API_KEY = "bcabf6a8-0641-11f0-a4a9-0242ac130003-bcabf72a-0641-11f0-a4a9-0242ac130003" # Page configuration
@@ -42,7 +45,8 @@ def fetch_openweather_data(lat, lon, datetime_input):
42
  response = requests.get(url) # Make the API call
43
  response.raise_for_status() # Raise an error for bad responses
44
  data = response.json() # Parse JSON response
45
-
 
46
  current_weather_data = data.get('data', [])[0] if data.get('data', []) else {}
47
  processed_entry = {
48
  'timestamp': datetime_input,
@@ -52,7 +56,7 @@ def fetch_openweather_data(lat, lon, datetime_input):
52
  'humidity': current_weather_data.get('humidity'),
53
  'wind_speed': current_weather_data.get('wind_speed')
54
  }
55
-
56
  openweather_historical_readings.append(processed_entry)
57
 
58
 
 
12
  import pytz
13
 
14
 
15
+ # Set up logging
16
+ logging.basicConfig(level=logging.DEBUG)
17
+
18
  # --- API KEYS ---
19
  OPENWEATHER_API_KEY = "c6c267b301a145ddec9b381e7d87a5af"
20
  STORMGLASS_API_KEY = "bcabf6a8-0641-11f0-a4a9-0242ac130003-bcabf72a-0641-11f0-a4a9-0242ac130003" # Page configuration
 
45
  response = requests.get(url) # Make the API call
46
  response.raise_for_status() # Raise an error for bad responses
47
  data = response.json() # Parse JSON response
48
+ # Log the data
49
+ logging.debug(f"Data: {data}")
50
  current_weather_data = data.get('data', [])[0] if data.get('data', []) else {}
51
  processed_entry = {
52
  'timestamp': datetime_input,
 
56
  'humidity': current_weather_data.get('humidity'),
57
  'wind_speed': current_weather_data.get('wind_speed')
58
  }
59
+ logging.debug(f"Processed Entry: {processed_entry}")
60
  openweather_historical_readings.append(processed_entry)
61
 
62