Revert "Bugfix for broken TWC alerts"

This reverts commit 685f6bc451a2c45d873e55e36de2bd89a832e47a.
This commit is contained in:
April 2022-10-19 19:12:36 -07:00
parent 685f6bc451
commit a0ac6453cf
No known key found for this signature in database
GPG Key ID: 17A9A017FAA4DE5E

View File

@ -1,4 +1,3 @@
from weakref import KeyedRef
import requests import requests
import json import json
import os import os
@ -34,6 +33,9 @@ def getAlerts(location):
theCode = response.status_code theCode = response.status_code
#Our global variables
#Set the actions based on response code #Set the actions based on response code
if theCode == 204: if theCode == 204:
print('No alerts for area ' + location + '.\n') print('No alerts for area ' + location + '.\n')
@ -65,7 +67,6 @@ def getAlerts(location):
elif theCode == 200: elif theCode == 200:
pass pass
try:
#Alright lets map our headline variables. #Alright lets map our headline variables.
l.debug('Found Alert for ' + location + '\n') l.debug('Found Alert for ' + location + '\n')
dataH = response.json() dataH = response.json()
@ -314,11 +315,6 @@ def getAlerts(location):
with open('./.temp/alertmanifest.txt', "a") as c: with open('./.temp/alertmanifest.txt', "a") as c:
c.write('\n' + location + '_' + x['phenomena'] + '_' + x['significance'] + '_' + str(x['processTimeUTC'])) c.write('\n' + location + '_' + x['phenomena'] + '_' + x['significance'] + '_' + str(x['processTimeUTC']))
c.close() c.close()
except KeyError:
# For some reason, TWC will return a 200 even though there's no alerts present in the API.
l.error("DO NOT REPORT THE ERROR BELOW")
l.error("Failed to write BERecord - Returned 200 but had no alerts.")
os.remove('./.temp/BERecord.xml')
# TODO: This should be converted into a function so it works better with async, that way we're not getting hung up on that time.sleep() call. # TODO: This should be converted into a function so it works better with async, that way we're not getting hung up on that time.sleep() call.