def getLanIp(): interfaces = psutil.net_if_addrs() stats = psutil.net_if_stats() for interface_name, snics in interfaces.items(): if interface_name in stats and stats[interface_name].isup: print(interface_name) for snic in snics: if snic.family == socket.AF_INET: return snic.address
submitted by /u/Celestial-being117
[link] [comments]
r/learnpython def getLanIp(): interfaces = psutil.net_if_addrs() stats = psutil.net_if_stats() for interface_name, snics in interfaces.items(): if interface_name in stats and stats[interface_name].isup: print(interface_name) for snic in snics: if snic.family == socket.AF_INET: return snic.address submitted by /u/Celestial-being117 [link] [comments]
def getLanIp(): interfaces = psutil.net_if_addrs() stats = psutil.net_if_stats() for interface_name, snics in interfaces.items(): if interface_name in stats and stats[interface_name].isup: print(interface_name) for snic in snics: if snic.family == socket.AF_INET: return snic.address
submitted by /u/Celestial-being117
[link] [comments]