Last active
June 28, 2017 03:11
-
-
Save ntrepid8/c5aec63d2f731b6575f8f5e5cebbf39f to your computer and use it in GitHub Desktop.
Simple python script to parse speedtest-cli --simple output into a CSV line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import fileinput | |
import datetime | |
input_lines = [] | |
for line in fileinput.input(): | |
input_lines.append(line) | |
ping_key,ping_val,ping_unit = input_lines[0].split(" ") | |
download_key,download_val,download_unit = input_lines[1].split(" ") | |
upload_key,upload_val,upload_unit = input_lines[2].split(" ") | |
dt_log = datetime.datetime.utcnow().isoformat() | |
# print the output CSV line | |
# datetime,ping,download,upload | |
print('"%(dt_log)s","%(ping_val)s","%(download_val)s","%(upload_val)s"' % locals()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A simple script to parse the output from
speedtest --simple
into a CSV line: