{"library":"netifaces2","title":"Portable Network Interface Information (Fork)","description":"netifaces2 is a Python library providing portable access to network interface information. It is a fork of the original `netifaces` library, offering improved support, particularly for Windows, and is actively maintained. The current version is 0.0.22, with recent updates focusing on stability and new features like listing interfaces by name and index, enhancing Windows compatibility.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install netifaces2"],"cli":null},"imports":["import netifaces2\nnetifaces2.interfaces()","import netifaces2\nnetifaces2.ifaddresses('eth0')","from netifaces2 import AF_INET"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import netifaces2\n\nprint(f\"All interfaces: {netifaces2.interfaces()}\")\n\nfor i in netifaces2.interfaces():\n    print(f\"\\nInterface: {i}\")\n    addrs = netifaces2.ifaddresses(i)\n    if netifaces2.AF_INET in addrs:\n        for link in addrs[netifaces2.AF_INET]:\n            print(f\"  IPv4: {link.get('addr')}\")\n    if netifaces2.AF_INET6 in addrs:\n        for link in addrs[netifaces2.AF_INET6]:\n            print(f\"  IPv6: {link.get('addr')}\")\n    if netifaces2.AF_LINK in addrs:\n        for link in addrs[netifaces2.AF_LINK]:\n            print(f\"  MAC: {link.get('addr')}\")","lang":"python","description":"This example demonstrates how to list all network interfaces and retrieve their IPv4, IPv6, and MAC addresses using `netifaces2`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}