use new cms colleciton

This commit is contained in:
Will Freeman committed 2026-02-25 09:08:23 -07:00
1 parent e4b3a9bee6
commit d867624770
1 file changed
+3 -4
+3 -4
View File
@@ -24,7 +24,7 @@ def fetch_alpr_surveillance_nodes(usOnly=True):
raise RuntimeError(f"Failed to fetch data from Overpass API. Status code: {response.status_code}") raise RuntimeError(f"Failed to fetch data from Overpass API. Status code: {response.status_code}")
def fetch_wins_count(): def fetch_wins_count():
cms_url = "https://cms.deflock.me/items/RecentWins" cms_url = "https://cms.deflock.me/items/flockWins"
headers = {'User-Agent': 'deflock-alpr-counts/1.0'} headers = {'User-Agent': 'deflock-alpr-counts/1.0'}
response = requests.get(cms_url, headers=headers) response = requests.get(cms_url, headers=headers)
@@ -32,10 +32,9 @@ def fetch_wins_count():
if response.status_code == 200: if response.status_code == 200:
response_json = response.json() response_json = response.json()
try: try:
win_instances = response_json['data']['WinInstances'] return len(response_json['data'])
return len(win_instances)
except (KeyError, TypeError) as e: except (KeyError, TypeError) as e:
raise RuntimeError("Could not find 'data.WinInstances' in the response.") raise RuntimeError("Could not find 'data' array in the response.")
else: else:
raise RuntimeError(f"Failed to fetch data from CMS. Status code: {response.status_code}") raise RuntimeError(f"Failed to fetch data from CMS. Status code: {response.status_code}")