cfg json bullcrap
This commit is contained in:
parent
63e79c5a4c
commit
4afc4b3ad0
4
.gitignore
vendored
4
.gitignore
vendored
@ -11,4 +11,6 @@ tiles/*
|
||||
__pycache__/
|
||||
|
||||
# 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__)
|
||||
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. """
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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}"
|
||||
|
@ -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}"
|
||||
|
@ -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}"
|
||||
|
@ -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):
|
||||
|
@ -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}"
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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}"
|
||||
|
@ -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)
|
||||
|
@ -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}"
|
||||
|
@ -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}"
|
||||
|
@ -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()
|
||||
|
@ -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}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user