Last active
September 12, 2024 11:30
-
-
Save adiralashiva8/b21e1d07dca26f1c8da53cbfd5c689b1 to your computer and use it in GitHub Desktop.
Python script to read .har file and print respective result
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
# Installation: | |
-------------- | |
# pip install haralyzer | |
# Code: | |
------- | |
import json | |
from haralyzer import HarParser, HarPage | |
with open('google.har', 'r', encoding='utf-8') as f: | |
har_parser = HarParser(json.loads(f.read())) | |
for page in har_parser.pages: | |
for entry in page.entries: | |
print(entry['request']['method'], entry['response']['status'], round(entry['time'],2), entry['request']['url']) | |
# Response: | |
----------- | |
# GET 200 3093.69 https://github.com/adiralashiva8/adiralashiva8 | |
# GET 200 220.22 https://github.githubassets.com/assets/light-3e154969b9f9.css | |
# GET 200 106.73 https://github.githubassets.com/assets/dark-9c5b7a476542.css |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment