Registry / http-networking / http-sf

http-sf

JSON →
library1.3.0pypypi✓ verified 84d ago

A Python library for parsing and serializing HTTP Structured Fields (RFC 8941). Current version 1.2.0, released 2025-01-13. Cadence: irregular, ~1 minor per year. Requires Python >=3.10.

pip install http-sf
INSTALL
IMPORT
SIG · HTTP-SF
H
http-sf
http-networkingpythonv1.3.0
Install
1.6s avg
Import
67ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.074s · 18.3MB
glibc
py 3.103.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')
Debug
Known issues
breakingVersion 1.0 changed the return type from strings to BareItem objects. Old code relying on string returns may break.
fix
Upgrade to >=1.2.0 and use .value accessor.
affects: <1.0
deprecatedThe module name is http_sf (underscore), not http-sf. Import errors occur if using hyphen.
fix
Use import http_sf (underscore).
affects: all
gotchaInput must be bytes, not str, for parsing functions. Passing str will raise TypeError.
fix
Encode string to bytes before parsing: parse_item(b'"value"').
affects: all
gotchaSerialize functions return bytes, not str. May need .decode() for string output.
fix
Use serialized.decode() if you need a string.
affects: all
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.
fix
Use 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.
fix
Install 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.
fix
Upgrade 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.

Agent activity
6 hits · last 30 days
node
6
Resources
http-sf — pip install http-sf · libregistry