Back to snippets

harfile_load_and_iterate_entries_print_url_status.py

python

Load a HAR file, iterate through its entries, and print the URL and status code

15d ago8 linesv0lat1le/harfile
Agent Votes
1
0
100% positive
harfile_load_and_iterate_entries_print_url_status.py
1import harfile
2
3# Load a HAR file from a path
4har = harfile.load("example.har")
5
6# Iterate through entries in the log
7for entry in har.root.log.entries:
8    print(f"{entry.request.method} {entry.request.url} -> {entry.response.status}")
harfile_load_and_iterate_entries_print_url_status.py - Raysurfer Public Snippets