harfile
Writer for HTTP Archive (HAR) files
Decision gist · record as of 2026-08-14
Yes, for test and debugging workflows that need HAR output. The zero-dependency design, permissive license, and active maintenance make it a low-risk choice. The single-threaded constraint and lack of page support are acceptable trade-offs for most recording use cases; verify that your HAR field requirements match the library's scope before adopting.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Single-threaded environment only; pages are not supported.
- Low friction: pure Python wheel with no runtime dependencies.
- Active maintenance with a recent release (77 days ago) and current repository activity.
License · maintenance · safety
MIT (permissive) — MIT permissive license allows commercial and private use with minimal restrictions; attribution required.
last release 2026-05-29 (77 days) · last repo commit 2026-08-10 · 2 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,744,639 downloads/mo, #2,909 on PyPI
Alternatives
Verify before relying
import datetime
import harfile
with harfile.open("output.har") as har:
har.add_entry(
startedDateTime=datetime.datetime.now(datetime.timezone.utc),
time=42,
request=harfile.Request(method="GET", url="http://example.com", httpVersion="HTTP/1.1"),
response=harfile.Response(status=200, statusText="OK", httpVersion="HTTP/1.1"),
timings=harfile.Timings(send=0, wait=0, receive=0),
)- Whether the package handles all HAR specification fields or only a subset
- Performance characteristics with large numbers of entries
- Validation of HAR output against the official HAR specification
What it is and what it does
harfile is a minimal, zero-dependency library for programmatically writing HTTP Archive (HAR) files in Python. It provides a context manager interface to build HAR files by adding individual HTTP request/response entries with timing data, suitable for recording network activity in test scenarios or debugging workflows.
The package is designed for single-threaded use and does not support HAR's page grouping feature. It accepts entries via a simple API that takes request, response, timing, and metadata objects, then serializes them to standard HAR format. With no external dependencies and support for modern Python versions (3.8 through 3.14), it integrates easily into testing and monitoring pipelines.
Use it for
- Record HTTP interactions during integration tests and save them as HAR files for analysis or replay
- Generate HAR archives from captured network traffic in debugging or performance profiling workflows
- Export request/response logs from a test suite in a standardized format for sharing with other tools
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, for test and debugging workflows that need HAR output.
The zero-dependency design, permissive license, and active maintenance make it a low-risk choice. The single-threaded constraint and lack of page support are acceptable trade-offs for most recording use cases; verify that your HAR field requirements match the library's scope before adopting.
Install
harfile on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Active maintenance with a recent release (77 days ago) and current repository activity.
Single-threaded environment only; pages are not supported.
License in practice
MIT permissive license allows commercial and private use with minimal restrictions; attribution required.
Quickstart
import datetime
import harfile
with harfile.open("output.har") as har:
har.add_entry(
startedDateTime=datetime.datetime.now(datetime.timezone.utc),
time=42,
request=harfile.Request(method="GET", url="http://example.com", httpVersion="HTTP/1.1"),
response=harfile.Response(status=200, statusText="OK", httpVersion="HTTP/1.1"),
timings=harfile.Timings(send=0, wait=0, receive=0),
)
Verify before relying
- Whether the package handles all HAR specification fields or only a subset
- Performance characteristics with large numbers of entries
- Validation of HAR output against the official HAR specification
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 77 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,744,639 / month, #2,909 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Testing |
Evidence: harfile-0.5.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “HAR file writer”
- harfileWrites HTTP Archive (HAR) files in Python with zero external…
- ndjsonProvides a familiar JSON Lines (ndjson) parser and writer with an API…
- pure-pcapy3Pure-Python implementation of the pcapy API for reading and writing…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also warcio · pylightxl · unix-ar · libarchive-c · ar · aiofile · kaldiio · pyorc · pmtiles · savepagenow