Skip to content

Commit 5242a58

Browse files
authored
Merge pull request #26 from ManuelMcLure/fix_no_ipv6_gateways
Sometimes ni.gateways() doesn't return IPV6
2 parents 9e94ba1 + b8c4ff4 commit 5242a58

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

octoprint_wifistatus/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,19 @@ def update_wifi_status(self):
146146
gateways = []
147147
gws = ni.gateways()
148148
for af in [ni.AF_INET, ni.AF_INET6]:
149-
for gw in gws[af]:
150-
gateways.append(gw[0] + " " + gw[1] + (" (Default)" if gw[2] else ""))
149+
try:
150+
for gw in gws[af]:
151+
gateways.append(gw[0] + " " + gw[1] + (" (Default)" if gw[2] else ""))
152+
except KeyError:
153+
pass
151154
net_data["gateways"] = gateways
152155

153156
self._logger.debug(net_data)
154157

155158
self._plugin_manager.send_plugin_message(self._identifier, net_data)
156159
except Exception as exc:
157-
self._logger.debug(f"WiFiStatus: timer exception: {exc.args}")
160+
self._logger.debug(f"WiFiStatus: timer exception",
161+
exc_info=sys.exc_info())
158162

159163
def get_update_information(self):
160164
return {

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
plugin_identifier = "wifistatus"
66
plugin_package = "octoprint_{}".format(plugin_identifier)
77
plugin_name = "WiFi Status"
8-
plugin_version = "1.8.0"
8+
plugin_version = "1.8.1"
99
plugin_description = "Displays WiFi status on the navbar"
1010
plugin_author = "Manuel McLure"
1111
plugin_author_email = "[email protected]"

0 commit comments

Comments
 (0)