-
Notifications
You must be signed in to change notification settings - Fork 0
/
fast.py
37 lines (27 loc) · 869 Bytes
/
fast.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
30
31
32
33
34
35
36
37
import time
import configparser
import iperf3
import json
import logging
from subprocess import check_output
from datetime import datetime
from time import sleep
## TO DO: also save json files to unique file, for logs. ALSO retry iperf when can't connect
config = configparser.ConfigParser()
time = datetime.now()
config.sections()
config.read('main.conf')
config.sections()
logging.basicConfig(format='[%(levelname)s] %(asctime)s %(message)s ',filename='ping.log',level=logging.DEBUG)
base_port = int(config['DEFAULT']['Port'])
server_hostname = config['DEFAULT']['Hostname']
logging.info("Performing fast.com test....")
download = 0
try:
download = check_output("fast")
except:
d = 0
# print(check_output("fast", shell=True, stderr=subprocess.STDOUT))
# download = check_output("fast")
print("{download:", download, "}")
logging.info("Complete!\n")