-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcfspeedtest.py
29 lines (24 loc) · 950 Bytes
/
cfspeedtest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
Originally written by tevslin.
Modified and repackaged for use in this docker image by ccmpbll.
no arguments required:
--debug write trace of io using logger (default does not)
--json output written to sysout is json rather than formatted text
"""
try:
from . import cfspeedtestclass
except:
import cfspeedtestclass
import json
import argparse
def main():
parser=argparse.ArgumentParser(
description='Runs speed test of net connection using ping and Cloudflare')
parser.add_argument('--debug',action='store_true',help='log network io')
parser.add_argument('--json',action='store_true',help='write json to sysout instead of formatted results')
args=parser.parse_args()
speedtest=cfspeedtestclass.cloudflare(debug=args.debug,printit=(not args.json)) #reopen with correct params
dict=speedtest.runalltests()
if args.json:
print (json.dumps(dict))
main()