mirror of
https://github.com/mewtek/i2ME-Legacy.git
synced 2025-05-12 01:10:24 -05:00
Grab county locations for alert areas
This commit is contained in:
parent
a0ac6453cf
commit
7dbf37cd08
@ -40,7 +40,7 @@ def getAirportCodes():
|
|||||||
|
|
||||||
return airports
|
return airports
|
||||||
|
|
||||||
def getZones():
|
def getAlertZones():
|
||||||
""" Returns a list of zones present in the MachineProductCfg """
|
""" Returns a list of zones present in the MachineProductCfg """
|
||||||
zones = []
|
zones = []
|
||||||
for i in data['Config']['ConfigDef']['ConfigItems']['ConfigItem']:
|
for i in data['Config']['ConfigDef']['ConfigItems']['ConfigItem']:
|
||||||
@ -51,6 +51,8 @@ def getZones():
|
|||||||
for x in i['@value'].split(','):
|
for x in i['@value'].split(','):
|
||||||
zones.append(x)
|
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
|
@ -2,7 +2,7 @@ import requests
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from datetime import datetime,timedelta
|
from datetime import datetime,timedelta
|
||||||
from Util.MachineProductCfg import getZones
|
from Util.MachineProductCfg import getAlertZones
|
||||||
import time
|
import time
|
||||||
import pytz
|
import pytz
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
@ -19,7 +19,7 @@ l = logging.getLogger(__name__)
|
|||||||
coloredlogs.install()
|
coloredlogs.install()
|
||||||
|
|
||||||
#Zones/Counties to fetch alerts for
|
#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
|
#You can safely edit the API key here. Make sure to include the ' before and after the key
|
||||||
headlineApiKey = '21d8a80b3d6b444998a80b3d6b1449d3'
|
headlineApiKey = '21d8a80b3d6b444998a80b3d6b1449d3'
|
||||||
@ -325,7 +325,7 @@ def makeRecord():
|
|||||||
BERecord.write('<Data type="BERecord">')
|
BERecord.write('<Data type="BERecord">')
|
||||||
BERecord.close()
|
BERecord.close()
|
||||||
|
|
||||||
for z in zones:
|
for z in alertLocations:
|
||||||
getAlerts(z)
|
getAlerts(z)
|
||||||
|
|
||||||
with open('./.temp/BERecord.xml', 'a') as BERecord:
|
with open('./.temp/BERecord.xml', 'a') as BERecord:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user