def get_machine_ips():
 addresses = []
 for interface in netifaces.interfaces():
  try:
   iface_data = netifaces.ifaddresses(interface)
   for family in iface_data:
    if (family not in (netifaces.AF_INET, netifaces.AF_INET6)):
     continue
    for address in iface_data[family]:
     addr = address['addr']
     if (family == netifaces.AF_INET6):
      addr = addr.split('%')[0]
     addresses.append(addr)
  except ValueError:
   pass
 return addresses

def get_machine_ips ( ) : addresses = [ ] for interface in netifaces . interfaces ( ) : try : iface_data = netifaces . ifaddresses ( interface ) for family in iface_data : if ( family not in ( netifaces . AF_INET , netifaces . AF_INET6 ) ) : continue for address in iface_data [ family ] : addr = address [ 'addr' ] if ( family == netifaces . AF_INET6 ) : addr = addr . split ( '%' ) [ 0 ] addresses . append ( addr ) except ValueError : pass return addresses
get the machines ip addresses :returns: list of strings of ip addresses .