Skip to main content

Structured HTTP Headers (handily)

Project description

HTTP Structured Field Values in Python

This is a Python 3 library implementing parsing and serialisation of HTTP Structured Fields.

The library's initial purpose is to prove the algorithms in the specification; as a result, it is not at all optimised. It tracks the specification closely, but since it is not yet an RFC, may change at any time.

The top-level parse and serialise functions are the ones your code should call.

Currently, this implements draft 17 of the specification.

Command Line Use

You can validate and examine the data model of a field value by calling the library on the command line, using -d, -l and i to denote dictionaries, lists and items respectively; e.g.,

> python3 -m http_sfv -i "foo;bar=baz"
[
    {
        "__type": "token",
        "value": "foo"
    },
    {
        "bar": {
            "__type": "token",
            "value": "baz"
        }
    }
]

or:

> python3 -m http_sfv -i "foo;&bar=baz"
FAIL: Key does not begin with lcalpha or * at: &bar=baz

Note that if successful, the output is in the JSON format used by the test suite.

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

http_sfv-0.8.tar.gz (9.7 kB view details)

Uploaded Source

File details

Details for the file http_sfv-0.8.tar.gz.

File metadata

  • Download URL: http_sfv-0.8.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for http_sfv-0.8.tar.gz
Algorithm Hash digest
SHA256 5fbfce5a66df8c57c563daa99bf124feb9369a1bc982e2492ca5945ca6447f1d
MD5 841c96a786e4e9bcec04e01e93ad5e16
BLAKE2b-256 68dd8e6f86ca0cf603b973b9ae41189f6abbe1e47dd5d304041c96b32d1166c2

See more details on using hashes here.

Provenance

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