Release History¶
Unreleased¶
2.0.0a1 -- 2026-06-24¶
Breaking Changes¶
- removed support for Python versions before 3.10
datastructures.LinkHeaderand its exposed parameter sequences are now immutable- converted positional Boolean parameters to keyword-only parameters
| Function | Parameter |
|---|---|
| parse_accept | strict |
| parse_content_type | normalize_parameter_values |
| parse_forwarded | only_standard_parameters |
| parse_link | strict |
Added¶
ietfparse.constantsmodule -- this contains constant ContentType instancesdatastructures.LinkHeader.relproperty- indexed parameter lookup in
datastructures.LinkHeader datastructures.ImmutableSequencehelper class- public
errors.MalformedContentType,errors.MalformedListSegment, anderrors.StrictHeaderParsingFailureexceptions for malformed parser inputs.MalformedContentTyperemains aValueErrorsubclass for compatibility. defaultparameter toalgorithms.select_content_type- packaged
ietfparse.testbenchmark utility for the directly supported HTTP header parsers, including theietfparse-testconsole script, thepython -m ietfparse.testentry point, implementation benchmarks, adjacent library comparisons, and saved-result diff reporting - curated adjacent-library comparison suites and documentation for
Accept,Cache-Control, andLinkparsing behavior
Changed¶
algorithms.select_content_typenow accepts parsedContentTypeinstances, content-type strings, or a rawAcceptheader string asrequested, and it also accepts string entries inavailableheaders.parse_linkchanged to allow multiplemediaandtypeparameters as described in RFC-8288.headers.parse_linknow preserves parentheses and escaped delimiters inside link targets and quoted parameter values, preserves valueless parameters, and raisesMalformedLinkValuefor malformed parameter syntax instead of misparsing the remainder of the header.datastructures.LinkHeaderchanged to combine multiple relationship type (rel) parameters into a single space-separated parameter as described in RFC-8288. Note that this is only relevant if you disable strict mode parsing.headers.parse_content_typechanged to raiseMalformedContentTypeerror instead ofValueError.headers.parse_content_typenow strips nested HTTP comments without treating parentheses inside quoted parameter values as comments.datastructures.ContentTypeinstances can now be compared to stringsdatastructures.ContentType.qualityis now normalized metadata. Missing and effectively maximal values normalize to1.0, rejected values normalize to0.0, intermediate values are rounded to three decimal places, and theAccept*parsers now share the same quality-handling rules while preserving the preference for explicitly declared maximum quality values.- list-based header parsers now ignore stray empty items produced by extra
commas, while
headers.parse_listpreserves those empty items andheaders.parse_accept(..., strict=True)treats them as malformed. - list-style header parsing now preserves escaped quotes and commas inside
quoted values for
headers.parse_list,headers.parse_cache_control,headers.parse_forwarded, andheaders.parse_accept. headers.parse_listnow raiseserrors.MalformedListSegmentwhen a quoted item is followed by additional non-delimited content instead of silently merging it into a malformed value.- parser internals were simplified and optimized for token, quoted-string, and list parsing hot paths, reducing overhead in the public header parsers
Removed¶
- previously deprecated functions:
parse_http_accept_header,parse_link_header,parse_list_header,remove_url_auth,rewrite_url
Development environment changes¶
- added pre-commit utility usage
- replaced setuptools with uv
- introduced just
- switched from sphinx to zensical
- switched to the src layout
1.9.0 -- 2022-07-08¶
Deprecated¶
- using
len()on the return value fromalgorithms.remove_url_auth rewrite_urlandremove_url_auth. Use yarl instead. It is an awesome library and a more general solution.
Changed¶
algorithms.RemoveUrlAuthResultfrom a named tuple to a proper class.- Replace type hints with annotations.
Removed¶
ietfparse.compatmodule.- universal wheels
1.8.0 -- 2021-08-11¶
Removed¶
- support for Python versions before 3.7
1.7.0 -- 2020-11-04¶
Behavioural Change¶
headers.parse_accept used to fail with a ValueError when it encountered
an invalid content type value in the header. Now it skips the invalid value
instead. If you want the previous behaviour, then pass strict=True.
Added¶
- support for Python 3.7-3.9
Removed¶
- support for 3.4 and 3.5
Changed¶
- clarified that
headers.parse_content_typeraises aValueErrorwhen it encounters an invalid content type header headers.parse_acceptskips unparseable content types unless the newstrictkeyword parameter is truthy
1.6.1 -- 2020-01-26¶
Fixed¶
- corrected packaging metadata
1.6.0 -- 2020-01-25¶
Added¶
- typestubs
Changed¶
- switched from travis-ci to circle-ci
- allow "bad whitespace" around
=in link header parameter lists as indicated in RFC-8288 - replaced nosetests with python -m unittest
1.5.1 -- 2018-03-04¶
Added¶
- RFC-6839 content suffix support in
datastructures.ContentTypeandheaders.parse_content_type()
1.5.0 -- 2017-12-24¶
Deprecated¶
- the
normalized_parameter_valueskeyword parameter to theheaders._parse_parameter_listfunction
Added¶
normalize_parameter_nameskeyword parameter to theheaders._parse_parameter_listfunction. This replaces thenormalized_parameter_valueskeyword parameter.- support for parsing Forwarded headers with
headers.parse_forwarded algorithms.remove_url_authfunction
Removed¶
- support for Python 2.6 and 3.3
Changed¶
headers.parse_accept()now prefers explicit highest quality preferences over the inferred highest quality preferences
1.4.3 -- (2017-10-30)¶
Changed¶
The parsing of qualified lists now retains the initial ordering whenever
possible. The algoritm prefers explicit highest quality preferences (1.0)
over inferred highest quality preferences. It also retains the initial
ordering in the presense of multiple highest quality matches. This affects
the headers.parse_accept_charset, headers.parse_accept_encoding and
headers.parse_accept_language functions.
1.4.2 -- (2017-07-04)¶
Added¶
- formatting of Link headers using
str(header)
1.4.1 -- (2017-04-03)¶
Added¶
- error handling documentation for header parsing functions
1.4.0 -- (2016-10-18)¶
Added¶
headers.parse_accept_encodingwhich parse the Accept-Encoding headerheaders.parse_accept_languagewhich parses the Accept-Language header
Fixed¶
- parsing of parameter lists values ending in a quote character. For example,
max-age=5, x-foo="prune"was parsed as['max-age=5', 'x-foo="prune']
1.3.0 -- (2016-08-11)¶
Added¶
- Cache-Control header parsing with
headers.parse_cache_control
Deprecated¶
headers.parse_http_accept_headerrenamed toheaders.parse_acceptheaders.parse_link_headerrenamed toheaders.parse_linkheaders.parse_list_headerrenamed toheaders.parse_list
1.2.2 -- (2015-05-27)¶
Added¶
headers.parse_list_headerwhich parses generic comma-separated list headers with support for quoted partsheaders.parse_accept_charsetwhich parses the Accept-Charset header into a sorted list
1.2.1 -- (2015-05-25)¶
Fixed¶
algorithms.select_content_type only worked with the augmented
datastructures.ContentType values returned from the
algorithms.parse_http_accept_header. IOW, the algorithm required
that the quality attribute existed on instances. RFC-9110
requires that missing quality values are treated as 1
1.2.0 -- (2015-04-19)¶
Added¶
headers.parse_link_headerwhich parses Link headers.datastructures.LinkHeaderclass
1.1.1 -- (2015-02-10)¶
Removed¶
- the
setupextmodule since it was causing problems with source distributions
1.1.0 -- (2014-10-26)¶
Added¶
algorithms.rewrite_urlfunction
1.0.0 -- (2014-09-21)¶
Initial implementation containing the following functionality:
- algorithms.select_content_type function
- datastructures.ContentType class
- errors.NoMatch class
- errors.RootException class
- headers.parse_content_type function
- headers.parse_http_accept_header function