-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
This what we started to see during the installation
DEPRECATION: Building 'netifaces' using the legacy setup.py bdist_wheel mechanism,
which will be removed in a future version. pip 25.3 will enforce this behaviour change.
A possible replacement is to use the standardized build interface by setting the
`--use-pep517` option, (possibly combined with `--no-build-isolation`), or adding a
`pyproject.toml` file to the source tree of 'netifaces'. Discussion can be found
at https://github.com/pypa/pip/issues/6334
And netifaces package is not supported anymore, should we swith to psutil?
That's what we use netifaces for:
>>> import netifaces
>>> netifaces.AF_INET
2
>>> netifaces.interfaces()
['lo0', 'gif0', 'stf0', 'en5', 'ap1', 'en0', 'awdl0', 'llw0', 'en1', 'en2', 'en3', 'en4',
'bridge0', 'utun0', 'utun1', 'utun2', 'utun3', 'vmenet0', 'bridge100', 'en7']
>>> netifaces.ifaddresses('lo0')
{2: [{'addr': '127.0.0.1', 'netmask': '255.0.0.0', 'peer': '127.0.0.1'}],
30: [{'addr': '::1', 'netmask': 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/128', 'peer': '::1', 'flags': 0},
{'addr': 'fe80::1%lo0', 'netmask': 'ffff:ffff:ffff:ffff::/64', 'flags': 0}]}
and this is the alternative:
import socket
import psutil
iface = 'en0'
for net_if in psutil.net_if_addrs().get(iface, []):
if net_if.family == socket.AF_INET:
print(net_if.address)
break
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels