Spaces:
Sleeping
Sleeping
File size: 618 Bytes
50f0958 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import requests
# Test the heatmap endpoint
response = requests.get('http://localhost:8000/api/threats/heatmap', timeout=15)
print('Status:', response.status_code)
if response.status_code == 200:
data = response.json()
cities = data.get('heatmap_data', [])
print(f'Total cities: {len(cities)}')
for city in cities[:3]:
print(f"{city['city']}: {city['threatCount']} threats ({city['threatLevel']})")
print(f" High: {city['highRiskCount']}, Medium: {city['mediumRiskCount']}, Low: {city['lowRiskCount']}")
print()
else:
print('Error:', response.text)
|