跳转到主要内容

HTTP存档(HAR)文件编写器

项目描述

harfile

CI Coverage Version Python versions License

此包为Python提供零依赖的HAR(HTTP存档)文件构建编写器。

注意:

  • 编写器假定单线程
  • 不支持页面

用法

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

许可证

此项目中使用的代码根据MIT许可证许可。通过向harfile做出贡献,您同意您的贡献将根据其MIT许可证进行许可。

项目详情


下载文件

为您的平台下载文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源代码分发

harfile-0.3.0.tar.gz (9.9 kB 查看哈希值)

上传于 源代码

构建分发版

harfile-0.3.0-py3-none-any.whl (6.8 kB 查看哈希值)

上传于 Python 3

支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面