Measure Network Data with Python

半城伤御伤魂 提交于 2019-11-30 08:55:50
aayoubi

To check the network traffic on your system, i recommend you look into psutil:

>>> psutil.net_io_counters(pernic=True)
{'lo': iostat(bytes_sent=799953745, bytes_recv=799953745, packets_sent=453698, packets_recv=453698), 
 'eth0': iostat(bytes_sent=734324837, bytes_recv=4163935363, packets_sent=3605828, packets_recv=4096685)}
>>>

And to shutdown your OS, if you are on windows check this: OS Reboot, Shutdown, Hibernate, Sleep, Wakeup (Windows Python)

and if you are using linux/unix, use the subprocess module to send the shutdown/reboot command.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!