Install & Compatibility
Where this runs
tested against v1.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.074s · 18.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.060s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
parse_item
✓ from http_sf import parse_item
serialize_item
✓ from http_sf import serialize_item
parse_list
✓ from http_sf import parse_list
serialize_list
✓ from http_sf import serialize_list
parse_dictionary
✓ from http_sf import parse_dictionary
serialize_dictionary
✓ from http_sf import serialize_dictionary
Parses and serializes HTTP Structured Fields (RFC 8941). Functions for item, list, and dictionary types. All return BareItem objects with .value and .params.
from http_sf import parse_item, serialize_item
# Parse a structured field string
parsed = parse_item('"hello world"')
print(parsed.value) # hello world
# Serialize back to string
serialized = serialize_item(parsed)
print(serialized) # b'"hello world"'
# With parameters: parse_item(b'i=1;a=true')
Errors
Common errors & fixes
TypeError: argument should be bytes, buffer or ASCII string, not 'str'
Passing a Python str instead of bytes to parse functions.
fixUse parse_item(b'...') instead of parse_item('...'). TypeError: cannot import name 'parse_item' from 'http_sf'
Wrong module name; often confused with 'http-sf' (hyphen) or 'http_sf' not installed.
fixInstall with 'pip install http-sf' and import as 'from http_sf import parse_item'.
AttributeError: 'BareItem' object has no attribute 'value'
Using older version (<1.0) where BareItem was a string.
fixUpgrade to >=1.2.0: pip install --upgrade http-sf.
Upgrade
Version history
1.3.0latest on PyPI · released May 25, 2026
Audit
Dependencies
No dependency data recorded yet.