File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 99import random
1010import string
1111import flask
12+ import octoprint
13+ import ipaddress
1214
1315try :
1416 from secrets import token_hex
@@ -17,7 +19,6 @@ def token_hex(n):
1719 letters = string .ascii_letters + string .digits
1820 return "" .join ([random .choice (letters ) for i in range (n )])
1921
20- import netaddr .ip
2122from octoprint .util .net import sanitize_address
2223from octoprint .util .platform import (
2324 get_os as octoprint_get_os ,
@@ -317,8 +318,8 @@ def get_local_ip(plugin):
317318def is_local_address (plugin , address ):
318319 try :
319320 address = sanitize_address (address )
320- ip = netaddr . IPAddress (address )
321- return ip .is_private () or ip .is_loopback ()
321+ ip = ipaddress . ip_address (address )
322+ return ip .is_private or ip .is_loopback
322323 except Exception as exc :
323324 _logger .error (
324325 'could not determine whether {} is local address ({})' .format (
You can’t perform that action at this time.
0 commit comments