Speedtest python script12/11/2023 ![]() ![]() I use it this way: speedtest-cli -simple cut -d' ' -f1,2 sed -e 's/ //g' tr ' ' ' ' There are almost certainly more elegant ways to extract the data from this output: Ping: 34.332 ms Download: 2.60 Mbit/s Upload: 1. The above location seems to be common for Ubuntu, but not across all versions of Unix/Linux. You will also need the speedtest python script or something similar. Version colorama0.4.4 PIP Command pip install colorama Requires Python >2.7, 3.0. (Again, you should double-check the location of the speedtest.py file. Description Speed test module for Python Version speedtest0.0.1 Command pip install speedtest Requires Python >3.7 COLORAMA Description Cross-platform colored terminal text. O /usr/lib/python3/dist-packages/speedtest.py checking Internet Speed using python programs Section 1: Installation step 1: install the speedtest-cli package using the command given in the block. Or you could try downloading that version of the speedtest.py file yourself: sudo gzip -k9 /usr/lib/python3/dist-packages/speedtest.py Then run Python echo client on another machine that sends some data to echo server, makes sure it receives the same data back and measures the turnaround time. It's too complex for a simple one-line sed command, but you could still apply it yourself manually. Sed -i "s/^ map(int, server_config\.split(','))$/ map(int, (server_config.split(',') if len(server_config) else ) )/" /usr/lib/python3/dist-packages/speedtest.pyĮDIT: the final patch is at, and published in v2.1.3. Sudo gzip -k9 /usr/lib/python3/dist-packages/speedtest.py If you're in Ubuntu or similar, and you have the file in the location shown in your output, you can fix it with: # Backup original code Looking at the first commit in the PR, you just need to modify a single line in speedtest.py. Return self.view_functions(**req.view_args)įile "/root/post_test2.py", line 11, in homeįile "/usr/lib/python3/dist-packages/speedtest.py", line 1091, in _init_įile "/usr/lib/python3/dist-packages/speedtest.From this speedtest-cli Pull Request, I gather the speedtest site have changed something in the response their API gives out. Return gi_app(environ, start_response)įile "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2450, in wsgi_appįile "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1867, in handle_exceptionįile "/usr/local/lib/python3.8/dist-packages/flask/_compat.py", line 39, in reraiseįile "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2447, in wsgi_appįile "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1952, in full_dispatch_requestįile "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1821, in handle_user_exceptionįile "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1950, in full_dispatch_requestįile "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1936, in dispatch_request S = speedtest.Speedtest(source_address=source)ĮDIT: This is the error: Traceback (most recent call last):įile "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2464, in _call_ ![]() I have also tried to search before posting on StackOverflow. I have read Speedtest python API documentation and mostly copied code from there. It works well for eth0 (192.168.1.21), but I get an error if I try to use a different interface, in this case, eth1 (192.168.8.100). From this speedtest-cli Pull Request, I gather the speedtest site have changed something in the response their API gives out. I would like to measure the internet speed of the different interface, in this case - eth1. I have eth0, eth1 and wlan0 connected to my Raspberry Pi. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |