Common: Call get_network_interfaces() from get_my_ip_addresses()

This commit is contained in:
Mike Salvatore 2022-09-16 08:52:54 -04:00
parent 247441663d
commit c82ee2ce97
1 changed files with 1 additions and 5 deletions

View File

@ -6,11 +6,7 @@ from netifaces import AF_INET, ifaddresses, interfaces
def get_my_ip_addresses() -> Sequence[str]:
ip_list = []
for interface in interfaces():
addresses = ifaddresses(interface).get(AF_INET, [])
ip_list.extend([link["addr"] for link in addresses if link["addr"] != "127.0.0.1"])
return ip_list
return [str(interface.ip) for interface in get_network_interfaces()]
def get_network_interfaces() -> List[IPv4Interface]: