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.4.0.tar.gz (10.1 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.4.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for harfile-0.4.0.tar.gz
Algorithm Hash digest
SHA256 34e2d9ef34101d769566bffab3c420e147776174308bed1a036ed8db600cabde
MD5 30b72a2f360385a932f2ece976a53b9d
BLAKE2b-256 885606ebfce8ee11b906db9984d7442edfb05e8eb495ed2f553857c1c793dbd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for harfile-0.4.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.4.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for harfile-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ddb1483cb30f7549ddc67c0b7fdc6424f1feb19373b67e33e429b02f09bf43a8
MD5 61eda8de8545325580190f6c886abf69
BLAKE2b-256 97b7aff025c4b69bd611f1594b22e4793ee0ac68600d12c687d09f665c40f88e

See more details on using hashes here.

Provenance

The following attestation bundles were made for harfile-0.4.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