March 2019
Beginner
490 pages
12h 40m
English
There are other Python packages that are not specifically designed to obtain network interfaces in a computer, but they have some function for doing this task. For example, the psutil package (https://pypi.org/project/psutil) allows tasks related to process and system monitoring in Python.
This package provides the net_if_addrs() method for getting information related to network interfaces:
import psutilpsutil.net_if_addrs()
The information is returned in a dictionary structure, as follows:
{'Local Area Connection* 11': [snicaddr(family=<AddressFamily.AF_LINK: -1>, address='00-FF-C0-63-12-57', netmask=None, broadcast=None, ptp=None), snicaddr(family=<AddressFamily.AF_INET: 2>, address='169.254.219.137', ...Read now
Unlock full access