Markiewicz_praca/hartocsv.py
2022-03-23 11:48:16 +01:00

17 lines
796 B
Python

import json
import sys
sys.stdout.reconfigure(encoding='utf-8')
f = json.loads(open("har.har", 'r', encoding='utf-8').read())
csv = "rozmiar, czas, czas blokady, czas polaczenia, czas procesowania\n"
for entry in f['log']['entries']:
if 'data' in entry['request']['url']:
size = entry['request']['bodySize'] + entry['request']['headersSize'] + entry['response']['bodySize'] + entry['response']['headersSize']
size=size*0.001
time = entry['time']
blocking = entry['timings']['blocked']
if blocking<0: blocking=0
connection = entry['timings']['dns'] + entry['timings']['connect'] + entry['timings']['ssl']
processingTime = entry['timings']['wait']
csv += f'{size}, {time}, {blocking}, {connection}, {processingTime}\n'
print(csv)