Grab county locations for alert areas

This commit is contained in:
April 2022-10-20 00:25:32 -07:00
parent a0ac6453cf
commit 7dbf37cd08
No known key found for this signature in database
GPG Key ID: 17A9A017FAA4DE5E
2 changed files with 8 additions and 6 deletions

View File

@ -40,7 +40,7 @@ def getAirportCodes():
return airports
def getZones():
def getAlertZones():
""" Returns a list of zones present in the MachineProductCfg """
zones = []
for i in data['Config']['ConfigDef']['ConfigItems']['ConfigItem']:
@ -51,6 +51,8 @@ def getZones():
for x in i['@value'].split(','):
zones.append(x)
return zones
if i['@key'] == "secondaryCounties" and i['@value'] != "":
for x in i['@value'].split(','):
zones.append(x)
print(getZones())
return zones

View File

@ -2,7 +2,7 @@ import requests
import json
import os
from datetime import datetime,timedelta
from Util.MachineProductCfg import getZones
from Util.MachineProductCfg import getAlertZones
import time
import pytz
import xml.dom.minidom
@ -19,7 +19,7 @@ l = logging.getLogger(__name__)
coloredlogs.install()
#Zones/Counties to fetch alerts for
zones = getZones()
alertLocations = getAlertZones()
#You can safely edit the API key here. Make sure to include the ' before and after the key
headlineApiKey = '21d8a80b3d6b444998a80b3d6b1449d3'
@ -325,7 +325,7 @@ def makeRecord():
BERecord.write('<Data type="BERecord">')
BERecord.close()
for z in zones:
for z in alertLocations:
getAlerts(z)
with open('./.temp/BERecord.xml', 'a') as BERecord: