mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-07 06:40:15 +00:00
Added conditional import of netifaces
This commit is contained in:
parent
f5236878b0
commit
10854bfdbc
@ -286,7 +286,7 @@ class TCPServerInterface(Interface):
|
||||
@staticmethod
|
||||
def get_address_for_if(name):
|
||||
import importlib
|
||||
if importlib.find_loader('netifaces') != None:
|
||||
if importlib.util.find_spec('netifaces') != None:
|
||||
import netifaces
|
||||
return netifaces.ifaddresses(name)[netifaces.AF_INET][0]['addr']
|
||||
else:
|
||||
@ -297,7 +297,7 @@ class TCPServerInterface(Interface):
|
||||
@staticmethod
|
||||
def get_broadcast_for_if(name):
|
||||
import importlib
|
||||
if importlib.find_loader('netifaces') != None:
|
||||
if importlib.util.find_spec('netifaces') != None:
|
||||
import netifaces
|
||||
return netifaces.ifaddresses(name)[netifaces.AF_INET][0]['broadcast']
|
||||
else:
|
||||
|
@ -12,7 +12,7 @@ class UDPInterface(Interface):
|
||||
@staticmethod
|
||||
def get_address_for_if(name):
|
||||
import importlib
|
||||
if importlib.find_loader('netifaces') != None:
|
||||
if importlib.util.find_spec('netifaces') != None:
|
||||
import netifaces
|
||||
return netifaces.ifaddresses(name)[netifaces.AF_INET][0]['addr']
|
||||
else:
|
||||
@ -23,7 +23,7 @@ class UDPInterface(Interface):
|
||||
@staticmethod
|
||||
def get_broadcast_for_if(name):
|
||||
import importlib
|
||||
if importlib.find_loader('netifaces') != None:
|
||||
if importlib.util.find_spec('netifaces') != None:
|
||||
import netifaces
|
||||
return netifaces.ifaddresses(name)[netifaces.AF_INET][0]['broadcast']
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user