A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
MIT License
183
stars
43
forks
source link
Remove dependency to netifaces to make Windows usecases easier #46
The library netifaces requires Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio on windows.
As far as I understand the code, this library is only used in one function get_first_non_loopback_ip.
Is it possible to replace this library another one like pydron/ifaddr?
import ipaddress
import ifaddr
network = "192.168.178.0/24"
adapters = ifaddr.get_adapters()
def get_first_non_loopback_ip(network: str = "") -> str:
for adapter in adapters:
for iface in adapter.ips:
if iface.is_IPv4:
_ip = iface.ip
if network:
if ipaddress.ip_address(_ip) in ipaddress.ip_network(network):
return _ip
elif _ip != "127.0.0.1":
return _ip
return ""
print(get_first_non_loopback_ip(network))
This library works at least in my case under Linux and Windows without any installation problem.
Both libraries seems to have the same license (MIT).
The library netifaces requires
Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio
on windows. As far as I understand the code, this library is only used in one function get_first_non_loopback_ip.Is it possible to replace this library another one like pydron/ifaddr?
This library works at least in my case under Linux and Windows without any installation problem. Both libraries seems to have the same license (MIT).