{"id":21441,"library":"http-sf","title":"http-sf","description":"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.","status":"active","version":"1.2.0","language":"python","source_language":"en","source_url":"https://github.com/Groover/http-sf","tags":["http","structured-fields","rfc-8941","serialization","parsing"],"install":[{"cmd":"pip install http-sf","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"parse_item","correct":"from http_sf import parse_item"},{"note":"","wrong":"","symbol":"serialize_item","correct":"from http_sf import serialize_item"},{"note":"","wrong":"","symbol":"parse_list","correct":"from http_sf import parse_list"},{"note":"","wrong":"","symbol":"serialize_list","correct":"from http_sf import serialize_list"},{"note":"","wrong":"","symbol":"parse_dictionary","correct":"from http_sf import parse_dictionary"},{"note":"","wrong":"","symbol":"serialize_dictionary","correct":"from http_sf import serialize_dictionary"}],"quickstart":{"code":"from http_sf import parse_item, serialize_item\n\n# Parse a structured field string\nparsed = parse_item('\"hello world\"')\nprint(parsed.value)  # hello world\n\n# Serialize back to string\nserialized = serialize_item(parsed)\nprint(serialized)  # b'\"hello world\"'\n\n# With parameters: parse_item(b'i=1;a=true')","lang":"python","description":"Parses and serializes HTTP Structured Fields (RFC 8941). Functions for item, list, and dictionary types. All return BareItem objects with .value and .params."},"warnings":[{"fix":"Upgrade to >=1.2.0 and use .value accessor.","message":"Version 1.0 changed the return type from strings to BareItem objects. Old code relying on string returns may break.","severity":"breaking","affected_versions":"<1.0"},{"fix":"Use import http_sf (underscore).","message":"The module name is http_sf (underscore), not http-sf. Import errors occur if using hyphen.","severity":"deprecated","affected_versions":"all"},{"fix":"Encode string to bytes before parsing: parse_item(b'\"value\"').","message":"Input must be bytes, not str, for parsing functions. Passing str will raise TypeError.","severity":"gotcha","affected_versions":"all"},{"fix":"Use serialized.decode() if you need a string.","message":"Serialize functions return bytes, not str. May need .decode() for string output.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use parse_item(b'...') instead of parse_item('...').","cause":"Passing a Python str instead of bytes to parse functions.","error":"TypeError: argument should be bytes, buffer or ASCII string, not 'str'"},{"fix":"Install with 'pip install http-sf' and import as 'from http_sf import parse_item'.","cause":"Wrong module name; often confused with 'http-sf' (hyphen) or 'http_sf' not installed.","error":"TypeError: cannot import name 'parse_item' from 'http_sf'"},{"fix":"Upgrade to >=1.2.0: pip install --upgrade http-sf.","cause":"Using older version (<1.0) where BareItem was a string.","error":"AttributeError: 'BareItem' object has no attribute 'value'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}