Files
tf_provider/tools/har/check_op.py
T

23 lines
672 B
Python

import json
har_path = '/home/naeel/terra/har/faststart.har'
op_id = 'c2e44fae-2a05-4955-867c-763da66b578e'
with open(har_path, 'r', encoding='utf-8') as f:
har_data = json.load(f)
entries = har_data['log']['entries']
for entry in entries:
url = entry['request']['url']
if op_id in url and entry['request']['method'] == 'GET':
res = entry['response']
text = res['content'].get('text')
if text:
try:
data = json.loads(text)
print(f"Time: {entry['startedDateTime']}")
print(json.dumps(data, indent=2))
except Exception as e:
print(f"Error: {e}")