Files
tf_provider/tools/har/check_status.py
T

34 lines
1.1 KiB
Python

import json
import os
def check_creation_status(har_path):
print(f"--- Checking status in {os.path.basename(har_path)} ---")
with open(har_path, 'r', encoding='utf-8') as f:
har_data = json.load(f)
entries = har_data['log']['entries']
for entry in entries:
req = entry['request']
resp = entry['response']
# Check instanceOperations POST
if '/instanceOperations' in req['url'] and req['method'] == 'POST' and not '/instanceOperationCfsParams' in req['url']:
print(f"Found Operation POST: {req['url']}")
post_data = req.get('postData', {})
print(f"Request body: {post_data.get('text')}")
print(f"Response status: {resp['status']}")
resp_content = resp.get('content', {})
print(f"Response body: {resp_content.get('text')}")
print("-" * 20)
har_files = [
'/home/naeel/terra/har/f12vmbad.har',
'/home/naeel/terra/har/f12vmbad1.har',
'/home/naeel/terra/har/faststart.har'
]
for h in har_files:
if os.path.exists(h):
check_creation_status(h)