diff --git a/README.rst b/README.rst index 6da05fe..a25f2b2 100644 --- a/README.rst +++ b/README.rst @@ -89,6 +89,7 @@ Usage --server SERVER Specify a server ID to test against --mini MINI URL of the Speedtest Mini server --source SOURCE Source IP address to bind to + --timeout TIMEOUT HTTP timeout in seconds. Default 10 --version Show the version number and exit Inconsistency diff --git a/speedtest_cli.py b/speedtest_cli.py index 105c390..b790b56 100755 --- a/speedtest_cli.py +++ b/speedtest_cli.py @@ -484,6 +484,8 @@ def speedtest(): parser.add_argument('--server', help='Specify a server ID to test against') parser.add_argument('--mini', help='URL of the Speedtest Mini server') parser.add_argument('--source', help='Source IP address to bind to') + parser.add_argument('--timeout', default=10, type=int, + help='HTTP timeout in seconds. Default 10') parser.add_argument('--version', action='store_true', help='Show the version number and exit') @@ -498,6 +500,8 @@ def speedtest(): if args.version: version() + socket.setdefaulttimeout(args.timeout) + # If specified bind to a specific IP address if args.source: source = args.source