Registry / devops / http-sfv

http-sfv

JSON →
library0.9.9pypypiunverified

Library to parse and serialise HTTP Structured Field Values (RFC 8941). Current version 0.9.9. Release cadence is irregular; stable release expected.

pip install http-sfv
INSTALL
IMPORT
SIG · HTTP-SFV
H
http-sfv
devopspythonv0.9.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse_item
from http_sfv import parse_item
from http_sfv import parse_item

Basic usage: parse and serialize structured field values.

from http_sfv import parse_item, parse_list, serialize_item # Parse an HTTP structured field value item = parse_item('"hello world"') print(item.value) # 'hello world' # Parse a list lst = parse_list('"a", "b"') print([i.value for i in lst]) # Serialize back print(serialize_item(item)) # prints serialized string
Debug
Known issues
gotchaThe library returns custom classes (Item, InnerList, etc.) not built-in types. Comparing with == works, but type checks require specific imports.
fix
Use isinstance(value, http_sfv.Item) instead of type checking.
affects: >=0.9.0
gotchaParsing parameters can be tricky: parameters are stored as OrderedDict. In Python 3.8, dict ordering is guaranteed, but using OrderedDict may be unexpected.
fix
If order is not important, convert to dict: dict(item.params).
affects: >=0.9.0
deprecatedDirect instantiation of Item and InnerList classes may not be supported in future. Use parser functions.
fix
Always use parse_* functions to create structured types.
affects: <1.0.0
gotchaThe library currently does not support parsing of byte sequences from raw bytes; input must be a string. This is by design per RFC but may surprise users expecting bytes.
fix
Decode bytes to string before parsing: data.decode('utf-8').
affects: >=0.9.0
Upgrade
Version history
0.9.9latest on PyPI · released Jan 25, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
14
Resources
http-sfv — pip install http-sfv · libregistry