aprsd 1.0.0__py3-none-any.whl → 3.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aprsd/__init__.py +6 -4
- aprsd/cli_helper.py +151 -0
- aprsd/client/__init__.py +13 -0
- aprsd/client/aprsis.py +132 -0
- aprsd/client/base.py +105 -0
- aprsd/client/drivers/__init__.py +0 -0
- aprsd/client/drivers/aprsis.py +224 -0
- aprsd/client/drivers/fake.py +73 -0
- aprsd/client/drivers/kiss.py +119 -0
- aprsd/client/factory.py +88 -0
- aprsd/client/fake.py +48 -0
- aprsd/client/kiss.py +103 -0
- aprsd/client/stats.py +38 -0
- aprsd/cmds/__init__.py +0 -0
- aprsd/cmds/completion.py +22 -0
- aprsd/cmds/dev.py +162 -0
- aprsd/cmds/fetch_stats.py +156 -0
- aprsd/cmds/healthcheck.py +86 -0
- aprsd/cmds/list_plugins.py +319 -0
- aprsd/cmds/listen.py +230 -0
- aprsd/cmds/send_message.py +174 -0
- aprsd/cmds/server.py +142 -0
- aprsd/cmds/webchat.py +681 -0
- aprsd/conf/__init__.py +56 -0
- aprsd/conf/client.py +131 -0
- aprsd/conf/common.py +302 -0
- aprsd/conf/log.py +65 -0
- aprsd/conf/opts.py +80 -0
- aprsd/conf/plugin_common.py +191 -0
- aprsd/conf/plugin_email.py +105 -0
- aprsd/exception.py +13 -0
- aprsd/log/__init__.py +0 -0
- aprsd/log/log.py +138 -0
- aprsd/main.py +104 -867
- aprsd/messaging.py +4 -0
- aprsd/packets/__init__.py +12 -0
- aprsd/packets/collector.py +56 -0
- aprsd/packets/core.py +823 -0
- aprsd/packets/log.py +143 -0
- aprsd/packets/packet_list.py +116 -0
- aprsd/packets/seen_list.py +54 -0
- aprsd/packets/tracker.py +109 -0
- aprsd/packets/watch_list.py +122 -0
- aprsd/plugin.py +475 -284
- aprsd/plugin_utils.py +86 -0
- aprsd/plugins/__init__.py +0 -0
- aprsd/plugins/email.py +709 -0
- aprsd/plugins/fortune.py +61 -0
- aprsd/plugins/location.py +179 -0
- aprsd/plugins/notify.py +61 -0
- aprsd/plugins/ping.py +31 -0
- aprsd/plugins/time.py +115 -0
- aprsd/plugins/version.py +31 -0
- aprsd/plugins/weather.py +405 -0
- aprsd/stats/__init__.py +20 -0
- aprsd/stats/app.py +49 -0
- aprsd/stats/collector.py +38 -0
- aprsd/threads/__init__.py +11 -0
- aprsd/threads/aprsd.py +119 -0
- aprsd/threads/keep_alive.py +124 -0
- aprsd/threads/log_monitor.py +121 -0
- aprsd/threads/registry.py +56 -0
- aprsd/threads/rx.py +354 -0
- aprsd/threads/stats.py +44 -0
- aprsd/threads/tx.py +255 -0
- aprsd/utils/__init__.py +163 -0
- aprsd/utils/counter.py +51 -0
- aprsd/utils/json.py +80 -0
- aprsd/utils/objectstore.py +123 -0
- aprsd/utils/ring_buffer.py +40 -0
- aprsd/utils/trace.py +180 -0
- aprsd/web/__init__.py +0 -0
- aprsd/web/admin/__init__.py +0 -0
- aprsd/web/admin/static/css/index.css +84 -0
- aprsd/web/admin/static/css/prism.css +4 -0
- aprsd/web/admin/static/css/tabs.css +35 -0
- aprsd/web/admin/static/images/Untitled.png +0 -0
- aprsd/web/admin/static/images/aprs-symbols-16-0.png +0 -0
- aprsd/web/admin/static/images/aprs-symbols-16-1.png +0 -0
- aprsd/web/admin/static/images/aprs-symbols-64-0.png +0 -0
- aprsd/web/admin/static/images/aprs-symbols-64-1.png +0 -0
- aprsd/web/admin/static/images/aprs-symbols-64-2.png +0 -0
- aprsd/web/admin/static/js/charts.js +235 -0
- aprsd/web/admin/static/js/echarts.js +465 -0
- aprsd/web/admin/static/js/logs.js +26 -0
- aprsd/web/admin/static/js/main.js +231 -0
- aprsd/web/admin/static/js/prism.js +12 -0
- aprsd/web/admin/static/js/send-message.js +114 -0
- aprsd/web/admin/static/js/tabs.js +28 -0
- aprsd/web/admin/templates/index.html +196 -0
- aprsd/web/chat/static/css/chat.css +115 -0
- aprsd/web/chat/static/css/index.css +66 -0
- aprsd/web/chat/static/css/style.css.map +1 -0
- aprsd/web/chat/static/css/tabs.css +41 -0
- aprsd/web/chat/static/css/upstream/bootstrap.min.css +6 -0
- aprsd/web/chat/static/css/upstream/font.woff2 +0 -0
- aprsd/web/chat/static/css/upstream/google-fonts.css +23 -0
- aprsd/web/chat/static/css/upstream/jquery-ui.css +1311 -0
- aprsd/web/chat/static/css/upstream/jquery.toast.css +28 -0
- aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
- aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
- aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
- aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
- aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/icons.woff +0 -0
- aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/icons.woff2 +0 -0
- aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/outline-icons.woff +0 -0
- aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/outline-icons.woff2 +0 -0
- aprsd/web/chat/static/images/Untitled.png +0 -0
- aprsd/web/chat/static/images/aprs-symbols-16-0.png +0 -0
- aprsd/web/chat/static/images/aprs-symbols-16-1.png +0 -0
- aprsd/web/chat/static/images/aprs-symbols-64-0.png +0 -0
- aprsd/web/chat/static/images/aprs-symbols-64-1.png +0 -0
- aprsd/web/chat/static/images/aprs-symbols-64-2.png +0 -0
- aprsd/web/chat/static/images/globe.svg +3 -0
- aprsd/web/chat/static/js/gps.js +84 -0
- aprsd/web/chat/static/js/main.js +45 -0
- aprsd/web/chat/static/js/send-message.js +585 -0
- aprsd/web/chat/static/js/tabs.js +28 -0
- aprsd/web/chat/static/js/upstream/bootstrap.bundle.min.js +7 -0
- aprsd/web/chat/static/js/upstream/jquery-3.7.1.min.js +2 -0
- aprsd/web/chat/static/js/upstream/jquery-ui.min.js +13 -0
- aprsd/web/chat/static/js/upstream/jquery.toast.js +374 -0
- aprsd/web/chat/static/js/upstream/semantic.min.js +11 -0
- aprsd/web/chat/static/js/upstream/socket.io.min.js +7 -0
- aprsd/web/chat/templates/index.html +139 -0
- aprsd/wsgi.py +315 -0
- aprsd-3.4.1.dist-info/AUTHORS +13 -0
- aprsd-3.4.1.dist-info/LICENSE +175 -0
- aprsd-3.4.1.dist-info/METADATA +799 -0
- aprsd-3.4.1.dist-info/RECORD +134 -0
- {aprsd-1.0.0.dist-info → aprsd-3.4.1.dist-info}/WHEEL +1 -1
- aprsd-3.4.1.dist-info/entry_points.txt +8 -0
- aprsd/fake_aprs.py +0 -83
- aprsd/utils.py +0 -166
- aprsd-1.0.0.dist-info/AUTHORS +0 -6
- aprsd-1.0.0.dist-info/METADATA +0 -181
- aprsd-1.0.0.dist-info/RECORD +0 -13
- aprsd-1.0.0.dist-info/entry_points.txt +0 -4
- aprsd-1.0.0.dist-info/pbr.json +0 -1
- /aprsd/{fuzzyclock.py → utils/fuzzyclock.py} +0 -0
- {aprsd-1.0.0.dist-info → aprsd-3.4.1.dist-info}/top_level.txt +0 -0
aprsd/plugin_utils.py
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Utilities for plugins to use
|
2
|
+
import json
|
3
|
+
import logging
|
4
|
+
|
5
|
+
import requests
|
6
|
+
|
7
|
+
|
8
|
+
LOG = logging.getLogger("APRSD")
|
9
|
+
|
10
|
+
|
11
|
+
def get_aprs_fi(api_key, callsign):
|
12
|
+
LOG.debug(f"Fetch aprs.fi location for '{callsign}'")
|
13
|
+
try:
|
14
|
+
url = (
|
15
|
+
"http://api.aprs.fi/api/get?"
|
16
|
+
"&what=loc&apikey={}&format=json"
|
17
|
+
"&name={}".format(api_key, callsign)
|
18
|
+
)
|
19
|
+
response = requests.get(url)
|
20
|
+
except Exception:
|
21
|
+
raise Exception("Failed to get aprs.fi location")
|
22
|
+
else:
|
23
|
+
response.raise_for_status()
|
24
|
+
return json.loads(response.text)
|
25
|
+
|
26
|
+
|
27
|
+
def get_weather_gov_for_gps(lat, lon):
|
28
|
+
# FIXME(hemna) This is currently BROKEN
|
29
|
+
LOG.debug(f"Fetch station at {lat}, {lon}")
|
30
|
+
headers = requests.utils.default_headers()
|
31
|
+
headers.update(
|
32
|
+
{"User-Agent": "(aprsd, waboring@hemna.com)"},
|
33
|
+
)
|
34
|
+
try:
|
35
|
+
url2 = (
|
36
|
+
"https://forecast.weather.gov/MapClick.php?lat=%s"
|
37
|
+
"&lon=%s&FcstType=json" % (lat, lon)
|
38
|
+
# f"https://api.weather.gov/points/{lat},{lon}"
|
39
|
+
)
|
40
|
+
LOG.debug(f"Fetching weather '{url2}'")
|
41
|
+
response = requests.get(url2, headers=headers)
|
42
|
+
except Exception as e:
|
43
|
+
LOG.error(e)
|
44
|
+
raise Exception("Failed to get weather")
|
45
|
+
else:
|
46
|
+
response.raise_for_status()
|
47
|
+
return json.loads(response.text)
|
48
|
+
|
49
|
+
|
50
|
+
def get_weather_gov_metar(station):
|
51
|
+
LOG.debug(f"Fetch metar for station '{station}'")
|
52
|
+
try:
|
53
|
+
url = "https://api.weather.gov/stations/{}/observations/latest".format(
|
54
|
+
station,
|
55
|
+
)
|
56
|
+
response = requests.get(url)
|
57
|
+
except Exception:
|
58
|
+
raise Exception("Failed to fetch metar")
|
59
|
+
else:
|
60
|
+
response.raise_for_status()
|
61
|
+
return json.loads(response)
|
62
|
+
|
63
|
+
|
64
|
+
def fetch_openweathermap(api_key, lat, lon, units="metric", exclude=None):
|
65
|
+
LOG.debug(f"Fetch openweathermap for {lat}, {lon}")
|
66
|
+
if not exclude:
|
67
|
+
exclude = "minutely,hourly,daily,alerts"
|
68
|
+
try:
|
69
|
+
url = (
|
70
|
+
"https://api.openweathermap.org/data/2.5/onecall?"
|
71
|
+
"lat={}&lon={}&appid={}&units={}&exclude={}".format(
|
72
|
+
lat,
|
73
|
+
lon,
|
74
|
+
api_key,
|
75
|
+
units,
|
76
|
+
exclude,
|
77
|
+
)
|
78
|
+
)
|
79
|
+
LOG.debug(f"Fetching OWM weather '{url}'")
|
80
|
+
response = requests.get(url)
|
81
|
+
except Exception as e:
|
82
|
+
LOG.error(e)
|
83
|
+
raise Exception("Failed to get weather")
|
84
|
+
else:
|
85
|
+
response.raise_for_status()
|
86
|
+
return json.loads(response.text)
|
File without changes
|