harfile


Nameharfile JSON
Version 0.3.1 PyPI version JSON
download
home_pageNone
SummaryWriter for HTTP Archive (HAR) files
upload_time2025-08-17 16:02:49
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords har http testing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # harfile

[![CI](https://github.com/schemathesis/harfile/actions/workflows/ci.yml/badge.svg)](https://github.com/schemathesis/harfile/actions/workflows/ci.yml)
[![Coverage](https://codecov.io/gh/schemathesis/harfile/branch/main/graph/badge.svg)](https://codecov.io/gh/schemathesis/harfile/branch/main)
[![Version](https://img.shields.io/pypi/v/harfile.svg)](https://pypi.org/project/harfile/)
[![Python versions](https://img.shields.io/pypi/pyversions/harfile.svg)](https://pypi.org/project/harfile/)
[![License](https://img.shields.io/pypi/l/harfile.svg)](https://opensource.org/licenses/MIT)

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

```python
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](https://opensource.org/licenses/MIT).
By contributing to `harfile`, you agree that your contributions will be licensed under its MIT license.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "harfile",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Dmitry Dygalo <dmitry@dygalo.dev>",
    "keywords": "har, http, testing",
    "author": null,
    "author_email": "Dmitry Dygalo <dmitry@dygalo.dev>",
    "download_url": "https://files.pythonhosted.org/packages/28/df/213fdc493ec97400ec39a1a4bc87600b5b40f79abcb6fc603b46d1ad50f4/harfile-0.3.1.tar.gz",
    "platform": null,
    "description": "# harfile\n\n[![CI](https://github.com/schemathesis/harfile/actions/workflows/ci.yml/badge.svg)](https://github.com/schemathesis/harfile/actions/workflows/ci.yml)\n[![Coverage](https://codecov.io/gh/schemathesis/harfile/branch/main/graph/badge.svg)](https://codecov.io/gh/schemathesis/harfile/branch/main)\n[![Version](https://img.shields.io/pypi/v/harfile.svg)](https://pypi.org/project/harfile/)\n[![Python versions](https://img.shields.io/pypi/pyversions/harfile.svg)](https://pypi.org/project/harfile/)\n[![License](https://img.shields.io/pypi/l/harfile.svg)](https://opensource.org/licenses/MIT)\n\nThis package provides a zero-dependency writer for building HAR (HTTP Archive) files in Python.\n\n**NOTES**:\n\n- The writer assumes a single-threaded environment.\n- Pages are not supported.\n\n## Usage\n\n```python\nimport datetime\nimport io\n\nimport harfile\n\n\n# Write to a file\nwith harfile.open(\"filename.har\") as har:\n    har.add_entry(\n        startedDateTime=datetime.datetime.now(datetime.timezone.utc),\n        time=42,\n        request=harfile.Request(\n            method=\"GET\",\n            url=\"http://example.com\",\n            httpVersion=\"HTTP/1.1\",\n        ),\n        response=harfile.Response(\n            status=200,\n            statusText=\"OK\",\n            httpVersion=\"HTTP/1.1\",\n        ),\n        timings=harfile.Timings(\n            send=0,\n            wait=0,\n            receive=0,\n        ),\n    )\n\n\n# Write to a string buffer\nbuffer = io.StringIO()\nwith harfile.open(buffer) as har:\n    pass\n\n```\n\n## License\n\nThe code in this project is licensed under [MIT license](https://opensource.org/licenses/MIT).\nBy contributing to `harfile`, you agree that your contributions will be licensed under its MIT license.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Writer for HTTP Archive (HAR) files",
    "version": "0.3.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/schemathesis/harfile",
        "Changelog": "https://github.com/schemathesis/harfile/blob/main/CHANGELOG.md",
        "Funding": "https://github.com/sponsors/Stranger6667",
        "Source Code": "https://github.com/schemathesis/harfile"
    },
    "split_keywords": [
        "har",
        " http",
        " testing"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "047d975df0cd9d281118883e237a2fd515f9f2886e84281e243bc9cf02f776a4",
                "md5": "20c1da7058731f5497eced225e870f4b",
                "sha256": "27e63c98cba93b94175ac6407a5717badc2cd993daffd5a5bfdc893ebffb56ac"
            },
            "downloads": -1,
            "filename": "harfile-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "20c1da7058731f5497eced225e870f4b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6869,
            "upload_time": "2025-08-17T16:02:48",
            "upload_time_iso_8601": "2025-08-17T16:02:48.242853Z",
            "url": "https://files.pythonhosted.org/packages/04/7d/975df0cd9d281118883e237a2fd515f9f2886e84281e243bc9cf02f776a4/harfile-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "28df213fdc493ec97400ec39a1a4bc87600b5b40f79abcb6fc603b46d1ad50f4",
                "md5": "995f54c2fdf29cfb0332371061c7786f",
                "sha256": "8998fa4410ad17d7b5671bab36ea058adde835bbb27f6a3da4b423019da584da"
            },
            "downloads": -1,
            "filename": "harfile-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "995f54c2fdf29cfb0332371061c7786f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9990,
            "upload_time": "2025-08-17T16:02:49",
            "upload_time_iso_8601": "2025-08-17T16:02:49.456017Z",
            "url": "https://files.pythonhosted.org/packages/28/df/213fdc493ec97400ec39a1a4bc87600b5b40f79abcb6fc603b46d1ad50f4/harfile-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-17 16:02:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "schemathesis",
    "github_project": "harfile",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "harfile"
}
        
Elapsed time: 0.42459s