-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_sites.py
More file actions
24 lines (19 loc) · 832 Bytes
/
debug_sites.py
File metadata and controls
24 lines (19 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from data_fetcher import fetch_streamflow_data
import json
def test_state(state_code):
print(f"Testing state: {state_code}")
try:
data = fetch_streamflow_data(state_code)
if 'value' in data and 'timeSeries' in data['value']:
print(f" Found 'value' and 'timeSeries'. Count: {len(data['value']['timeSeries'])}")
for i, series in enumerate(data['value']['timeSeries']):
source_info = series.get('sourceInfo', {})
if i == 0:
print(f" First Item SourceInfo:")
print(json.dumps(source_info, indent=2))
break
else:
print(" 'value' or 'timeSeries' missing in response.")
except Exception as e:
print(f" Error: {e}")
test_state('TN')