Obtenir l'adresse IP
from netifaces import interfaces, ifaddresses, AF_INET
for ifaceName in interfaces():
addresses = [i['addr'] for i in ifaddresses(ifaceName).setdefault(AF_INET, [{'addr':'No IP addr'}] )]
print('%s: %s' % (ifaceName, ', '.join(addresses)))
>>>
lo: 127.0.0.1
enp30s0: No IP addr
wlp31s0: 192.168.1.56
FishBrawler