When I run the script, speed, mtu and isup doesn't change automatically. Only if I finish the process and start another time.
import psutil
import time
import os
stats = psutil.net_if_stats()
while True:
time.sleep(1)
os.system("clear")
for nic, addrs in psutil.net_if_addrs().items():
print("%s:" % (nic))
if nic in stats:
st = stats[nic]
print(" stats : ", end='')
print("speed=%sMB, mtu=%s, up=%s" % (
st.speed, st.mtu,
"yes" if st.isup else "no"))
I tried to get speed, mtu and isup of each addresses associated to each NIC (network interface card) and changing in this repeat loop, but it doesn't works like this.