Skip to main content

harfile

CI Coverage Version Python versions License

This package provides a zero-dependency writer for building HAR (HTTP Archive) files in Python.

NOTES:

  • The writer assumes a single-threaded environment.
  • Pages are not supported.

Usage

import datetime
import io

import harfile


# Write to a file
with harfile.open("filename.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,
        ),
    )


# Write to a string buffer
buffer = io.StringIO()
with harfile.open(buffer) as har:
    pass

License

The code in this project is licensed under MIT license. By contributing to harfile, you agree that your contributions will be licensed under its MIT license.

Release files for harfile 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for harfile 0.5.0
File Size Uploaded
harfile-0.5.0.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for harfile 0.5.0
File Interpreter ABI Platform
harfile-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.5 kB

Release files / harfile-0.5.0.tar.gz

Download URL harfile-0.5.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c1524b8f0a39dd9f19365760aefb3adbba951818310d17b2eaa293de1f4c170a
BLAKE2b-256 checksum
How to use checksums
8a0effbb98cd1910f1f898ddc62d649dbf0e3d68026ee9313d3cff035206b727
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 29, 2026.

Transparency log

Release files / harfile-0.5.0-py3-none-any.whl

Download URL harfile-0.5.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab8a01d0d21d3b7f5ad57e7dc56b8b829f6a8855c1fa143aad464e7e8169f5e3
BLAKE2b-256 checksum
How to use checksums
1e21949c004d730d610dac63bcf5964f2585e98aa7bd44ff570ef8844472e76b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page