werkzeug.parse_set_header¶
-
werkzeug.
parse_set_header
(value, on_update=None)[source]¶ Parse a set-like header and return a
HeaderSet
object:>>> hs = parse_set_header('token, "quoted value"')
The return value is an object that treats the items case-insensitively and keeps the order of the items:
>>> 'TOKEN' in hs True >>> hs.index('quoted value') 1 >>> hs HeaderSet(['token', 'quoted value'])
To create a header from the
HeaderSet
again, use thedump_header()
function.Parameters: - value – a set header to be parsed.
- on_update – an optional callable that is called every time a
value on the
HeaderSet
object is changed.
Returns: a
HeaderSet