Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

A library of classes for HAR data using pyserde.

The library is focused on providing a F-Algebra for HAR data and associated morphisms but also contains canonical types for basic usages.

F-Algebra classes

There is one generic-ish class for every HAR type and are affixed with F. All nested HAR types have been replaced with type parameters. Some types have no nested HAR types and so have no generic parameters but are included for completeness.

There is one edge case for post data. Since some of the parameters defined in the spec are mutually exclusive there are two classes for post data. PostDataParamF for ParamF based post data, and PostDataTextF for text based post data. There is a union type PostDataF combining the two for type hints but it cannot be constructed.

All of these types are Functory, by providing a nmap function that takes a function for each of the generic parameters. For example, see the ResponseF class below.

class ResponseF(Generic[A, B, C]):
   ...
   statusText: str
   httpVersion: str
   cookies: List[A]
   headers: List[B]
   content: C
   ...

   def nmap(
       self: "ResponseF[A, B, C]",
       f: Func[A, W],
       g: Func[B, X],
       h: Func[C, Y],
   ) -> "ResponseF[W, X, Y]":
       return replace(
           self,  # type: ignore[arg-type]
           cookies=list(map(f, self.cookies)),
           headers=list(map(g, self.headers)),
           content=h(self.content),
       )

Morphisms

Currently there are just 2 helper morphisms. harf_cata is a general catamorphsim, and harf which helps you build an algebra for harf_cata by taking explicit functions for each HAR type.

For example, if you wanted to count the number of times the string "key" is in headers you could do the following

harf(
    default=0,
    header=lambda h: h.count("key"),
    request=lambda r: sum(r.headers),
    response=lambda r: sum(r.headers),
    entry=lambda e: e.request + e.response,
    log=lambda l: sum(l.entries),
)(har_data)

Canonical/Basic types

For simple usages there are also type aliases for the canonical HAR structure. I.E. Response = ResponseF[Cookie, Header, Content]

Metadata

Release files for harf-serde 1.2a3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for harf-serde 1.2a3
File Size Uploaded Provenance Actions
harf-serde-1.2a3.tar.gz 5.7 kB Without provenance Details for harf-serde-1.2a3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for harf-serde 1.2a3
File Interpreter ABI Platform Actions
harf_serde-1.2a3-py3-none-any.whl Python 3 none any Details for harf_serde-1.2a3-py3-none-any.whl

Total release size: 12.2 kB

Release files / harf-serde-1.2a3.tar.gz

Download URL harf-serde-1.2a3.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2902d3fca4e2b717eb6580b7eb34ce8c04baa593afdc58d1e968de556d650c29
BLAKE2b-256 checksum
How to use checksums
00bb917c5e428b10f7ab2f94ddf4b69b94acb7875af398a2fab4653b67ce238e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release files / harf_serde-1.2a3-py3-none-any.whl

Download URL harf_serde-1.2a3-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31f51c3c9344440189143af1756b4485bdba91124978517cb20ecde35adb5554
BLAKE2b-256 checksum
How to use checksums
3f9551d2466b0612465f7c55e7ca973543c92bfe814d1757477b0ca1d7ce91ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Security for harf-serde 1.2a3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page