0

I'm writing a python script which consists of checking the current network usage of the computer, when downloading something. I've done a lot of research, and most of the things I find online are getting the MAX speed of the PC's NIC. In this case I want the current speed (like in mbps or something) only. The most promising solution I have come across yet is with the library "psutils". So the piece of code goes like this:

import psutil

download = psutil.net_io_counters(pernic=True)["Ethernet"][1]
print(download)

The output I get is '1392877555' which means it is definitely giving me something, but no matter what I have tried to alter this number, it is ALWAYS very close to this number. Only the last 3 digits vary. If I download something at my max speed my ISP allows me to, I get this number. If I reduce network usage to a minimum (I can monitor it in task manager for testing), I still get this number.

Any ideas why this is happening, or do I need to do something else with this data?

2
  • Try using "Wi-Fi" instead of "Ethernet". Commented Aug 27, 2021 at 21:30
  • @thirdsandfourths I'm on desktop with only ethernet. Wifi results in an error. Commented Aug 28, 2021 at 16:11

1 Answer 1

1

To get current network speed you can use speedtest-cli library. Using this library can give you the detailed info on your network speed and it's configurations. For more details you can refer to this article.

Sign up to request clarification or add additional context in comments.

1 Comment

This is precisely what I do NOT want. I do NOT want the MAX capacity of my downloads, I want the speed at which my NIC is working RIGHT NOW. If I am not downloading anything, I want a result close to 0. Speedtest-cli is just a regular speedtest.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.