Add timeout argument

This commit is contained in:
Matt Martz 2014-08-20 13:11:30 -05:00
parent 795bc51da4
commit 65c85a9b15
2 changed files with 5 additions and 0 deletions

View File

@ -89,6 +89,7 @@ Usage
--server SERVER Specify a server ID to test against --server SERVER Specify a server ID to test against
--mini MINI URL of the Speedtest Mini server --mini MINI URL of the Speedtest Mini server
--source SOURCE Source IP address to bind to --source SOURCE Source IP address to bind to
--timeout TIMEOUT HTTP timeout in seconds. Default 10
--version Show the version number and exit --version Show the version number and exit
Inconsistency Inconsistency

View File

@ -484,6 +484,8 @@ def speedtest():
parser.add_argument('--server', help='Specify a server ID to test against') 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('--mini', help='URL of the Speedtest Mini server')
parser.add_argument('--source', help='Source IP address to bind to') 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', parser.add_argument('--version', action='store_true',
help='Show the version number and exit') help='Show the version number and exit')
@ -498,6 +500,8 @@ def speedtest():
if args.version: if args.version:
version() version()
socket.setdefaulttimeout(args.timeout)
# If specified bind to a specific IP address # If specified bind to a specific IP address
if args.source: if args.source:
source = args.source source = args.source