diff --git a/Util/MachineProductCfg.py b/Util/MachineProductCfg.py index 221e8fe..d3547ea 100644 --- a/Util/MachineProductCfg.py +++ b/Util/MachineProductCfg.py @@ -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()) \ No newline at end of file + return zones \ No newline at end of file diff --git a/recordGenerators/Alerts.py b/recordGenerators/Alerts.py index fd2da32..b7295eb 100644 --- a/recordGenerators/Alerts.py +++ b/recordGenerators/Alerts.py @@ -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('') BERecord.close() - for z in zones: + for z in alertLocations: getAlerts(z) with open('./.temp/BERecord.xml', 'a') as BERecord: