CCockrum commited on
Commit
0a8f530
Β·
verified Β·
1 Parent(s): 5887dc1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -43,14 +43,14 @@ class EnhancedOceanClimateAgent:
43
  'units': units,
44
  'format': 'json'
45
  }
46
-
47
  try:
48
  print(f"πŸ“‘ Requesting {product} data for station {station_id}")
49
  print("πŸ• Date range:", start_date.strftime('%Y-%m-%d'), "to", end_date.strftime('%Y-%m-%d'))
 
50
  response = requests.get(self.noaa_base_url, params=params, timeout=30)
51
-
52
  print(f"πŸ” Status code: {response.status_code}")
53
-
54
  if response.status_code == 200:
55
  data = response.json()
56
  if 'data' in data:
@@ -62,8 +62,12 @@ class EnhancedOceanClimateAgent:
62
  print(f"❌ Unknown response structure: {data}")
63
  else:
64
  print(f"❌ API HTTP error {response.status_code}: {response.text}")
65
-
66
- return None
 
 
 
 
67
 
68
  def get_comprehensive_station_data(self, station_name, days_back=30):
69
  """Get comprehensive data from a NOAA station"""
 
43
  'units': units,
44
  'format': 'json'
45
  }
46
+
47
  try:
48
  print(f"πŸ“‘ Requesting {product} data for station {station_id}")
49
  print("πŸ• Date range:", start_date.strftime('%Y-%m-%d'), "to", end_date.strftime('%Y-%m-%d'))
50
+
51
  response = requests.get(self.noaa_base_url, params=params, timeout=30)
 
52
  print(f"πŸ” Status code: {response.status_code}")
53
+
54
  if response.status_code == 200:
55
  data = response.json()
56
  if 'data' in data:
 
62
  print(f"❌ Unknown response structure: {data}")
63
  else:
64
  print(f"❌ API HTTP error {response.status_code}: {response.text}")
65
+
66
+ except Exception as e:
67
+ print(f"❌ Request failed for {product}: {str(e)}")
68
+
69
+ return None
70
+
71
 
72
  def get_comprehensive_station_data(self, station_name, days_back=30):
73
  """Get comprehensive data from a NOAA station"""