speedtest
speedtest 是一个更加知名的工具。它是用 Python 写成的,可以使用 apt 或 pip 命令来安装。你可以在命令行下使用,也可以直接将其导入到你的 Python 项目。
安装方式:
sudo pip3 install speedtest-cli
使用的时候,可以直接运行 speedtest 命令即可:
$ speedtest
Retrieving speedtest.net configuration...
Testing from Tencent cloud computing (140.143.139.14)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Henan CMCC 5G (Zhengzhou) [9.69 km]: 28.288 ms
Testing download speed................................................................................
Download: 56.20 Mbit/s
Testing upload speed......................................................................................................
Upload: 1.03 Mbit/s