Allow timeout to be a float

This commit is contained in:
Matt Martz 2017-05-12 14:55:23 -05:00
parent 6bfa5922c3
commit f3a607feb2
1 changed files with 3 additions and 1 deletions

View File

@ -125,11 +125,13 @@ try:
from argparse import SUPPRESS as ARG_SUPPRESS from argparse import SUPPRESS as ARG_SUPPRESS
PARSER_TYPE_INT = int PARSER_TYPE_INT = int
PARSER_TYPE_STR = str PARSER_TYPE_STR = str
PARSER_TYPE_FLOAT = float
except ImportError: except ImportError:
from optparse import OptionParser as ArgParser from optparse import OptionParser as ArgParser
from optparse import SUPPRESS_HELP as ARG_SUPPRESS from optparse import SUPPRESS_HELP as ARG_SUPPRESS
PARSER_TYPE_INT = 'int' PARSER_TYPE_INT = 'int'
PARSER_TYPE_STR = 'string' PARSER_TYPE_STR = 'string'
PARSER_TYPE_FLOAT = 'float'
try: try:
from cStringIO import StringIO from cStringIO import StringIO
@ -1531,7 +1533,7 @@ def parse_args():
'supplied multiple times') 'supplied multiple times')
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=PARSER_TYPE_INT, parser.add_argument('--timeout', default=10, type=PARSER_TYPE_FLOAT,
help='HTTP timeout in seconds. Default 10') help='HTTP timeout in seconds. Default 10')
parser.add_argument('--secure', action='store_true', parser.add_argument('--secure', action='store_true',
help='Use HTTPS instead of HTTP when communicating ' help='Use HTTPS instead of HTTP when communicating '