how to get interet speed from pytohn code example

Example 1: how to test wifi speed py

$ pyspeedtest -h
usage: pyspeedtest [OPTION]...

Test your bandwidth speed using Speedtest.net servers.

optional arguments:
  -d L, --debug L   set http connection debug level (default is 0)
  -m M, --mode M    test mode: 1 - download
                               2 - upload
                               4 - ping
                               1 + 2 + 4 = 7 - all (default)
  -r N, --runs N    use N runs (default is 2)
  -s H, --server H  use specific server
  -v, --verbose     output additional information
  --version         show program's version number and exit

Example 2: how to test wifi speed py

$ pyspeedtest
Using server: speedtest.serv.pt
Ping: 9 ms
Download speed: 148.17 Mbps
Upload speed: 18.56 Mbps