Added the ability for the application to return the results as part of another programs run process

This commit is contained in:
Paul J Warner 2015-11-22 15:43:40 -06:00
parent 7b09d8759f
commit 942f551188
1 changed files with 9 additions and 2 deletions

View File

@ -547,7 +547,7 @@ def version():
raise SystemExit(__version__)
def speedtest():
def speedtest(**kwargs):
"""Run the full speedtest.net test"""
global shutdown_event, source, scheme
@ -715,7 +715,7 @@ def speedtest():
urls.append('%s/random%sx%s.jpg' %
(os.path.dirname(best['url']), size, size))
if not args.simple:
print_('Testing download speed', end='')
print_('Testing download speed PJW', end='')
dlspeed = downloadSpeed(urls, args.simple)
if not args.simple:
print_()
@ -784,6 +784,13 @@ def speedtest():
print_('Share results: %s://www.speedtest.net/result/%s.png' %
(scheme, resultid[0]))
speeds = {
'DL': (dlspeed / 1000 / 1000) * args.units[1],
'UL': (ulspeed / 1000 / 1000) * args.units[1]
}
return speeds
def main():
try: