Skip to main content

Writer for HTTP Archive (HAR) files

Project description

harfile

CI Coverage Version Python versions License

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

NOTES:

  • The writer assumes single-threaded
  • 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,
            status_text="OK",
            httpVersion="HTTP/1.1",
        ),
    )


# 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.3.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

harfile-0.3.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: harfile-0.3.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for harfile-0.3.0.tar.gz
Algorithm Hash digest
SHA256 23be8037e1296bb4787a15543a37835ed91f408c8296988f9ba022a44accad9e
MD5 2d1504fe3f858327c61ef11925ce492c
BLAKE2b-256 6d0ffc074af5572e3faeadce77c9bc82d7bd3bacd522ffae8f76599ecf1af8e3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: harfile-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for harfile-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac11177e06c88c9553c8c73c16ab20428a176d1d2ebe00b41ce527ff0bdc47e6
MD5 42ae08552514460ff1496e873064bc87
BLAKE2b-256 e66f46a3ca422a2580ee53e74ca4f19c7777a5d1108d6e0d82b37d8b0b427fdf

See more details on using hashes here.

Supported by

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