cfg json bullcrap
This commit is contained in:
parent
63e79c5a4c
commit
4afc4b3ad0
4
.gitignore
vendored
4
.gitignore
vendored
@ -11,4 +11,6 @@ tiles/*
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
|
|
||||||
# Temp directory
|
# Temp directory
|
||||||
.temp/
|
.temp/
|
||||||
|
|
||||||
|
conf.json
|
2
main.py
2
main.py
@ -15,7 +15,7 @@ with open("conf.json", "r") as file:
|
|||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
coloredlogs.install(logger=l)
|
coloredlogs.install(logger=l)
|
||||||
|
|
||||||
useRadarServer = cfg[useRadarServer]
|
useRadarServer = cfg["useRadarServer"]
|
||||||
|
|
||||||
async def createTemp():
|
async def createTemp():
|
||||||
""" Used on a first time run, creates necessary files & directories for the message encoder to work properly. """
|
""" Used on a first time run, creates necessary files & directories for the message encoder to work properly. """
|
||||||
|
@ -15,8 +15,8 @@ with open("conf.json", "r") as file:
|
|||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
coloredlogs.install()
|
coloredlogs.install()
|
||||||
|
|
||||||
MCAST_GRP = cfg[multicastGroup]
|
MCAST_GRP = cfg["multicastGroup"]
|
||||||
MCAST_IF = cfg[multicastIf]
|
MCAST_IF = cfg["multicastIf"]
|
||||||
BUF_SIZE = 1396
|
BUF_SIZE = 1396
|
||||||
|
|
||||||
MULTICAST_TTL = 2
|
MULTICAST_TTL = 2
|
||||||
|
@ -24,12 +24,12 @@ async def getValidTimestamps(radarType:str) -> list:
|
|||||||
async with aiohttp.ClientSession() as s:
|
async with aiohttp.ClientSession() as s:
|
||||||
if (radarType == "satrad"):
|
if (radarType == "satrad"):
|
||||||
maxImages = 12
|
maxImages = 12
|
||||||
url = "https://api.weather.com/v3/TileServer/series/productSet?apiKey=" + cfg[twcApiKey] + "&filter=satrad"
|
url = "https://api.weather.com/v3/TileServer/series/productSet?apiKey=" + cfg["twcApiKey"] + "&filter=satrad"
|
||||||
series = 'satrad'
|
series = 'satrad'
|
||||||
|
|
||||||
elif (radarType == "radarmosaic"):
|
elif (radarType == "radarmosaic"):
|
||||||
maxImages = 36
|
maxImages = 36
|
||||||
url = "https://api.weather.com/v3/TileServer/series/productSet?apiKey=" + cfg[twcApiKey] + "&filter=twcRadarMosaic"
|
url = "https://api.weather.com/v3/TileServer/series/productSet?apiKey=" + cfg["twcApiKey"] + "&filter=twcRadarMosaic"
|
||||||
series = 'twcRadarMosaic'
|
series = 'twcRadarMosaic'
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -52,9 +52,9 @@ async def downloadRadarFrames(radarType:str, timestamps: list) -> list:
|
|||||||
imagesToSend = []
|
imagesToSend = []
|
||||||
|
|
||||||
if (radarType == "satrad"):
|
if (radarType == "satrad"):
|
||||||
url_root = cfg[radarBaseUrl]
|
url_root = cfg["radarBaseUrl"]
|
||||||
elif (radarType == "radarmosaic"):
|
elif (radarType == "radarmosaic"):
|
||||||
url_root = cfg[radarBaseUrl]
|
url_root = cfg["radarBaseUrl"]
|
||||||
else:
|
else:
|
||||||
l.error(f'Invalid radar type "{radarType}" -- Valid radar types include "satrad", "radarmosaic"')
|
l.error(f'Invalid radar type "{radarType}" -- Valid radar types include "satrad", "radarmosaic"')
|
||||||
return
|
return
|
||||||
|
@ -38,7 +38,7 @@ async def getValidTimestamps(boundaries:ImageBoundaries) -> list:
|
|||||||
times = []
|
times = []
|
||||||
|
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
url = "https://api.weather.com/v3/TileServer/series/productSet?apiKey=" + cfg[twcApiKey] + "&filter=twcRadarMosaic"
|
url = "https://api.weather.com/v3/TileServer/series/productSet?apiKey=" + cfg["twcApiKey"] + "&filter=twcRadarMosaic"
|
||||||
async with session.get(url) as r:
|
async with session.get(url) as r:
|
||||||
response = await r.json()
|
response = await r.json()
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ async def getValidTimestamps(boundaries:ImageBoundaries) -> list:
|
|||||||
times = []
|
times = []
|
||||||
|
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
url = "https://api.weather.com/v3/TileServer/series/productSet?apiKey=" + cfg[twcApiKey] + "&filter=twcRadarMosaic"
|
url = "https://api.weather.com/v3/TileServer/series/productSet?apiKey=" + cfg["twcApiKey"] + "&filter=twcRadarMosaic"
|
||||||
async with session.get(url) as r:
|
async with session.get(url) as r:
|
||||||
response = await r.json()
|
response = await r.json()
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import json
|
|||||||
with open("conf.json", "r") as file:
|
with open("conf.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg[twcApiKey]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|
||||||
async def getData(coopId, geocode):
|
async def getData(coopId, geocode):
|
||||||
fetchUrl = f"https://api.weather.com/v2/indices/achePain/daypart/7day?geocode={geocode}&language=en-US&format=xml&apiKey={apiKey}"
|
fetchUrl = f"https://api.weather.com/v2/indices/achePain/daypart/7day?geocode={geocode}&language=en-US&format=xml&apiKey={apiKey}"
|
||||||
|
@ -31,7 +31,7 @@ import json
|
|||||||
with open("conf.json", "r") as file:
|
with open("conf.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg[twcApiKey]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|
||||||
async def getData(epaId, zipcode):
|
async def getData(epaId, zipcode):
|
||||||
url = f"https://api.weather.com/v1/location/{zipcode}:4:US/airquality.xml?language=en-US&apiKey={apiKey}"
|
url = f"https://api.weather.com/v1/location/{zipcode}:4:US/airquality.xml?language=en-US&apiKey={apiKey}"
|
||||||
|
@ -33,7 +33,7 @@ import json
|
|||||||
with open("conf.json", "r") as file:
|
with open("conf.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg[twcApiKey]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|
||||||
async def getData(airport):
|
async def getData(airport):
|
||||||
url = f"https://api.weather.com/v1/airportcode/{airport}/airport/delays.xml?language=en-US&apiKey={apiKey}"
|
url = f"https://api.weather.com/v1/airportcode/{airport}/airport/delays.xml?language=en-US&apiKey={apiKey}"
|
||||||
|
@ -26,8 +26,8 @@ import json
|
|||||||
with open("conf.json", "r") as file:
|
with open("conf.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
headlineApiKey = cfg[twcApiKey]
|
headlineApiKey = cfg["twcApiKey"]
|
||||||
detailsApiKey = cfg[twcApiKey]
|
detailsApiKey = cfg["twcApiKey"]
|
||||||
|
|
||||||
k = 0
|
k = 0
|
||||||
async def getAlerts(location):
|
async def getAlerts(location):
|
||||||
|
@ -34,7 +34,7 @@ import json
|
|||||||
with open("conf.json", "r") as file:
|
with open("conf.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg[twcApiKey]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|
||||||
async def getData(coopId, geocode):
|
async def getData(coopId, geocode):
|
||||||
fetchUrl = f"https://api.weather.com/v2/indices/breathing/daypart/7day?geocode={geocode}&language=en-US&format=xml&apiKey={apiKey}"
|
fetchUrl = f"https://api.weather.com/v2/indices/breathing/daypart/7day?geocode={geocode}&language=en-US&format=xml&apiKey={apiKey}"
|
||||||
|
@ -38,7 +38,7 @@ import json
|
|||||||
with open("conf.json", "r") as file:
|
with open("conf.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg[twcApiKey]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|
||||||
async def getData(tecci, zipCode):
|
async def getData(tecci, zipCode):
|
||||||
l.debug('Gathering data for location id ' + tecci)
|
l.debug('Gathering data for location id ' + tecci)
|
||||||
|
@ -36,7 +36,7 @@ import json
|
|||||||
with open("conf.json", "r") as file:
|
with open("conf.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg[twcApiKey]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|
||||||
async def getData(tecci, zipCode):
|
async def getData(tecci, zipCode):
|
||||||
fetchUrl = 'https://api.weather.com/v1/location/' + zipCode + ':4:US/forecast/daily/7day.xml?language=en-US&units=e&apiKey=' + apiKey
|
fetchUrl = 'https://api.weather.com/v1/location/' + zipCode + ':4:US/forecast/daily/7day.xml?language=en-US&units=e&apiKey=' + apiKey
|
||||||
|
@ -24,7 +24,7 @@ import json
|
|||||||
with open("conf.json", "r") as file:
|
with open("conf.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg[twcApiKey]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|
||||||
async def getData(coopId, geocode):
|
async def getData(coopId, geocode):
|
||||||
fetchUrl = f"https://api.weather.com/v2/indices/heatCool/daypart/7day?geocode={geocode}&language=en-US&format=xml&apiKey={apiKey}"
|
fetchUrl = f"https://api.weather.com/v2/indices/heatCool/daypart/7day?geocode={geocode}&language=en-US&format=xml&apiKey={apiKey}"
|
||||||
|
@ -36,7 +36,7 @@ import json
|
|||||||
with open("conf.json", "r") as file:
|
with open("conf.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg[twcApiKey]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|
||||||
async def getData(tecci, zipCode):
|
async def getData(tecci, zipCode):
|
||||||
l.debug('Gathering data for location id ' + tecci)
|
l.debug('Gathering data for location id ' + tecci)
|
||||||
|
@ -24,7 +24,7 @@ import json
|
|||||||
with open("conf.json", "r") as file:
|
with open("conf.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg[twcApiKey]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|
||||||
async def getData(coopId, geocode):
|
async def getData(coopId, geocode):
|
||||||
fetchUrl = f"https://api.weather.com/v2/indices/mosquito/daily/7day?geocode={geocode}&language=en-US&format=xml&apiKey={apiKey}"
|
fetchUrl = f"https://api.weather.com/v2/indices/mosquito/daily/7day?geocode={geocode}&language=en-US&format=xml&apiKey={apiKey}"
|
||||||
|
@ -35,7 +35,7 @@ import json
|
|||||||
with open("conf.json", "r") as file:
|
with open("conf.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg[twcApiKey]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|
||||||
async def getData(pollenId, geocode):
|
async def getData(pollenId, geocode):
|
||||||
fetchUrl = f"https://api.weather.com/v2/indices/pollen/daypart/7day?geocode={geocode}&language=en-US&format=xml&apiKey={apiKey}"
|
fetchUrl = f"https://api.weather.com/v2/indices/pollen/daypart/7day?geocode={geocode}&language=en-US&format=xml&apiKey={apiKey}"
|
||||||
|
@ -24,7 +24,7 @@ import json
|
|||||||
with open("conf.json", "r") as file:
|
with open("conf.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg[twcApiKey]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|
||||||
async def getData(tideStation, geocode):
|
async def getData(tideStation, geocode):
|
||||||
today = datetime.date.today()
|
today = datetime.date.today()
|
||||||
|
@ -24,7 +24,7 @@ import json
|
|||||||
with open("conf.json", "r") as file:
|
with open("conf.json", "r") as file:
|
||||||
cfg = json.load(file)
|
cfg = json.load(file)
|
||||||
|
|
||||||
apiKey = cfg[twcApiKey]
|
apiKey = cfg["twcApiKey"]
|
||||||
|
|
||||||
async def getData(coopId, geocode):
|
async def getData(coopId, geocode):
|
||||||
fetchUrl = f"https://api.weather.com/v2/indices/wateringNeeds/daypart/7day?geocode={geocode}&language=en-US&format=xml&apiKey={apiKey}"
|
fetchUrl = f"https://api.weather.com/v2/indices/wateringNeeds/daypart/7day?geocode={geocode}&language=en-US&format=xml&apiKey={apiKey}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user