mirror of
https://github.com/craigerl/aprsd.git
synced 2024-11-18 06:11:49 -05:00
re-enable USWeatherPlugin to use mapClick
The old MApClick.php api seems to work...re-enabling
This commit is contained in:
parent
3994235380
commit
986df391b2
@ -33,9 +33,9 @@ def get_weather_gov_for_gps(lat, lon):
|
|||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
url2 = (
|
url2 = (
|
||||||
# "https://forecast.weather.gov/MapClick.php?lat=%s"
|
"https://forecast.weather.gov/MapClick.php?lat=%s"
|
||||||
# "&lon=%s&FcstType=json" % (lat, lon)
|
"&lon=%s&FcstType=json" % (lat, lon)
|
||||||
f"https://api.weather.gov/points/{lat},{lon}"
|
#f"https://api.weather.gov/points/{lat},{lon}"
|
||||||
)
|
)
|
||||||
LOG.debug(f"Fetching weather '{url2}'")
|
LOG.debug(f"Fetching weather '{url2}'")
|
||||||
response = requests.get(url2, headers=headers)
|
response = requests.get(url2, headers=headers)
|
||||||
|
@ -37,11 +37,18 @@ class USWeatherPlugin(plugin.APRSDRegexCommandPluginBase, plugin.APRSFIKEYMixin)
|
|||||||
def process(self, packet):
|
def process(self, packet):
|
||||||
LOG.info("Weather Plugin")
|
LOG.info("Weather Plugin")
|
||||||
fromcall = packet.from_call
|
fromcall = packet.from_call
|
||||||
|
message = packet.get("message_text", None)
|
||||||
# message = packet.get("message_text", None)
|
# message = packet.get("message_text", None)
|
||||||
# ack = packet.get("msgNo", "0")
|
# ack = packet.get("msgNo", "0")
|
||||||
|
a = re.search(r"^.*\s+(.*)", message)
|
||||||
|
if a is not None:
|
||||||
|
searchcall = a.group(1)
|
||||||
|
searchcall = searchcall.upper()
|
||||||
|
else:
|
||||||
|
searchcall = fromcall
|
||||||
api_key = CONF.aprs_fi.apiKey
|
api_key = CONF.aprs_fi.apiKey
|
||||||
try:
|
try:
|
||||||
aprs_data = plugin_utils.get_aprs_fi(api_key, fromcall)
|
aprs_data = plugin_utils.get_aprs_fi(api_key, searchcall)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
LOG.error(f"Failed to fetch aprs.fi data {ex}")
|
LOG.error(f"Failed to fetch aprs.fi data {ex}")
|
||||||
return "Failed to fetch aprs.fi location"
|
return "Failed to fetch aprs.fi location"
|
||||||
|
Loading…
Reference in New Issue
Block a user