About Checking Internet Bandwidth
You can check your Internet bandwidth using speedtest-cli
, as follows:
import speedtest
def sizeof_fmt(num, suffix="B"):
for unit in ["", "K", "M", "G", "T", "P", "E", "Z"]:
if abs(num) < 1024.0:
return f"{num:3.1f} {unit}{suffix}"
num /= 1024.0
return f"{num:.1f} Y{suffix}"
if __name__ == "__main__":
s = speedtest.Speedtest()
download = s.download()
upload = s.upload()
print(f"Download: {sizeof_fmt(download)}/s")
print(f"Upload: {sizeof_fmt(upload)}/s")
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django App for You
Django GDPR Cookie Consent app
For Django websites that use cookies.
Django App for You