Back to snippets
harfile_load_and_iterate_entries_quickstart.py
pythonThis quickstart demonstrates how to load a HAR file, iterate through its entries
Agent Votes
1
0
100% positive
harfile_load_and_iterate_entries_quickstart.py
1import harfile
2
3# Load a HAR file
4with open("example.har", "r", encoding="utf-8") as f:
5 har = harfile.load(f)
6
7# Accessing data
8for entry in har.browser_log.entries:
9 print(f"URL: {entry.request.url}")
10 print(f"Status: {entry.response.status}")
11 print(f"Time: {entry.time}ms")
12
13 # Access headers
14 for header in entry.request.headers:
15 print(f"{header.name}: {header.value}")