cfg json bullcrap

This commit is contained in:
iRaven 2025-01-28 17:41:50 -06:00
parent 63e79c5a4c
commit 4afc4b3ad0
19 changed files with 26 additions and 24 deletions

4
.gitignore vendored
View File

@ -11,4 +11,6 @@ tiles/*
__pycache__/
# Temp directory
.temp/
.temp/
conf.json

View File

@ -15,7 +15,7 @@ with open("conf.json", "r") as file:
l = logging.getLogger(__name__)
coloredlogs.install(logger=l)
useRadarServer = cfg[useRadarServer]
useRadarServer = cfg["useRadarServer"]
async def createTemp():
""" Used on a first time run, creates necessary files & directories for the message encoder to work properly. """

View File

@ -15,8 +15,8 @@ with open("conf.json", "r") as file:
l = logging.getLogger(__name__)
coloredlogs.install()
MCAST_GRP = cfg[multicastGroup]
MCAST_IF = cfg[multicastIf]
MCAST_GRP = cfg["multicastGroup"]
MCAST_IF = cfg["multicastIf"]
BUF_SIZE = 1396
MULTICAST_TTL = 2

View File

@ -24,12 +24,12 @@ async def getValidTimestamps(radarType:str) -> list:
async with aiohttp.ClientSession() as s:
if (radarType == "satrad"):
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'
elif (radarType == "radarmosaic"):
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'
else:
@ -52,9 +52,9 @@ async def downloadRadarFrames(radarType:str, timestamps: list) -> list:
imagesToSend = []
if (radarType == "satrad"):
url_root = cfg[radarBaseUrl]
url_root = cfg["radarBaseUrl"]
elif (radarType == "radarmosaic"):
url_root = cfg[radarBaseUrl]
url_root = cfg["radarBaseUrl"]
else:
l.error(f'Invalid radar type "{radarType}" -- Valid radar types include "satrad", "radarmosaic"')
return

View File

@ -38,7 +38,7 @@ async def getValidTimestamps(boundaries:ImageBoundaries) -> list:
times = []
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:
response = await r.json()

View File

@ -19,7 +19,7 @@ async def getValidTimestamps(boundaries:ImageBoundaries) -> list:
times = []
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:
response = await r.json()

View File

@ -24,7 +24,7 @@ import json
with open("conf.json", "r") as file:
cfg = json.load(file)
apiKey = cfg[twcApiKey]
apiKey = cfg["twcApiKey"]
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}"

View File

@ -31,7 +31,7 @@ import json
with open("conf.json", "r") as file:
cfg = json.load(file)
apiKey = cfg[twcApiKey]
apiKey = cfg["twcApiKey"]
async def getData(epaId, zipcode):
url = f"https://api.weather.com/v1/location/{zipcode}:4:US/airquality.xml?language=en-US&apiKey={apiKey}"

View File

@ -33,7 +33,7 @@ import json
with open("conf.json", "r") as file:
cfg = json.load(file)
apiKey = cfg[twcApiKey]
apiKey = cfg["twcApiKey"]
async def getData(airport):
url = f"https://api.weather.com/v1/airportcode/{airport}/airport/delays.xml?language=en-US&apiKey={apiKey}"

View File

@ -26,8 +26,8 @@ import json
with open("conf.json", "r") as file:
cfg = json.load(file)
headlineApiKey = cfg[twcApiKey]
detailsApiKey = cfg[twcApiKey]
headlineApiKey = cfg["twcApiKey"]
detailsApiKey = cfg["twcApiKey"]
k = 0
async def getAlerts(location):

View File

@ -34,7 +34,7 @@ import json
with open("conf.json", "r") as file:
cfg = json.load(file)
apiKey = cfg[twcApiKey]
apiKey = cfg["twcApiKey"]
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}"

View File

@ -38,7 +38,7 @@ import json
with open("conf.json", "r") as file:
cfg = json.load(file)
apiKey = cfg[twcApiKey]
apiKey = cfg["twcApiKey"]
async def getData(tecci, zipCode):
l.debug('Gathering data for location id ' + tecci)

View File

@ -36,7 +36,7 @@ import json
with open("conf.json", "r") as file:
cfg = json.load(file)
apiKey = cfg[twcApiKey]
apiKey = cfg["twcApiKey"]
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

View File

@ -24,7 +24,7 @@ import json
with open("conf.json", "r") as file:
cfg = json.load(file)
apiKey = cfg[twcApiKey]
apiKey = cfg["twcApiKey"]
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}"

View File

@ -36,7 +36,7 @@ import json
with open("conf.json", "r") as file:
cfg = json.load(file)
apiKey = cfg[twcApiKey]
apiKey = cfg["twcApiKey"]
async def getData(tecci, zipCode):
l.debug('Gathering data for location id ' + tecci)

View File

@ -24,7 +24,7 @@ import json
with open("conf.json", "r") as file:
cfg = json.load(file)
apiKey = cfg[twcApiKey]
apiKey = cfg["twcApiKey"]
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}"

View File

@ -35,7 +35,7 @@ import json
with open("conf.json", "r") as file:
cfg = json.load(file)
apiKey = cfg[twcApiKey]
apiKey = cfg["twcApiKey"]
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}"

View File

@ -24,7 +24,7 @@ import json
with open("conf.json", "r") as file:
cfg = json.load(file)
apiKey = cfg[twcApiKey]
apiKey = cfg["twcApiKey"]
async def getData(tideStation, geocode):
today = datetime.date.today()

View File

@ -24,7 +24,7 @@ import json
with open("conf.json", "r") as file:
cfg = json.load(file)
apiKey = cfg[twcApiKey]
apiKey = cfg["twcApiKey"]
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}"