From d867624770a84c3549f5671ab4e59bc34cb07236 Mon Sep 17 00:00:00 2001 From: Will Freeman Date: Wed, 25 Feb 2026 09:08:23 -0700 Subject: [PATCH] use new cms colleciton --- serverless/alpr_counts/src/alpr_counts.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/serverless/alpr_counts/src/alpr_counts.py b/serverless/alpr_counts/src/alpr_counts.py index 618e66d..bc3bdc6 100644 --- a/serverless/alpr_counts/src/alpr_counts.py +++ b/serverless/alpr_counts/src/alpr_counts.py @@ -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}") 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'} response = requests.get(cms_url, headers=headers) @@ -32,10 +32,9 @@ def fetch_wins_count(): if response.status_code == 200: response_json = response.json() try: - win_instances = response_json['data']['WinInstances'] - return len(win_instances) + return len(response_json['data']) 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: raise RuntimeError(f"Failed to fetch data from CMS. Status code: {response.status_code}")