Created
March 9, 2020 20:09
-
-
Save exit99/2722ea56f95ccb0fd949d52d885b4a34 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import json | |
f = open("response_1583775904103.json", "r") | |
file_data = f.read() | |
f.close() | |
bw_data = json.loads(file_data) | |
out_total = 0 | |
in_total = 0 | |
num_rows = 0 | |
step = bw_data['metadata']['step'] | |
for raw_data in bw_data['bandwidthData']: | |
num_rows += 1 | |
in_cur = raw_data[2] | |
out_cur = raw_data[5] | |
if not out_cur: | |
out_cur = 0 | |
if not in_cur: | |
in_cur = 0 | |
out_total += (out_cur *8) | |
in_total += (in_cur *8) | |
out_total = out_total * step | |
in_total = in_total * step | |
print(f"Out Total: {out_total:9.2f}") | |
print(f"In Total: {in_total:9.2f}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment