I’m trying to build a python command-line program that monitors all available network interfaces in a machine. Similar to the popular (nload) which monitors the network bandwidth per interface, and (nethogs) commands which monitor network bandwidth per process I want to build a program that combine both options and also produce colored output.
nload

nethogs

My question is, how can I interact directly with the network interface from within python code? Is there a way to identity incoming/outgoing bandwidth speed? Is there a specific library that is recommended?