Skip to main content

Writer for HTTP Archive (HAR) files

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

harfile-0.5.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

harfile-0.5.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file harfile-0.5.0.tar.gz.

File metadata

  • Download URL: harfile-0.5.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for harfile-0.5.0.tar.gz
Algorithm Hash digest
SHA256 c1524b8f0a39dd9f19365760aefb3adbba951818310d17b2eaa293de1f4c170a
MD5 cc85e8c87bd99d48e84111a9b2567e41
BLAKE2b-256 8a0effbb98cd1910f1f898ddc62d649dbf0e3d68026ee9313d3cff035206b727

See more details on using hashes here.

Provenance

The following attestation bundles were made for harfile-0.5.0.tar.gz:

Publisher: release.yml on schemathesis/harfile

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file harfile-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: harfile-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for harfile-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab8a01d0d21d3b7f5ad57e7dc56b8b829f6a8855c1fa143aad464e7e8169f5e3
MD5 624b7f6ca829e3b5bbec4ef44799f8fe
BLAKE2b-256 1e21949c004d730d610dac63bcf5964f2585e98aa7bd44ff570ef8844472e76b

See more details on using hashes here.

Provenance

The following attestation bundles were made for harfile-0.5.0-py3-none-any.whl:

Publisher: release.yml on schemathesis/harfile

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page