werkzeug.parse_options_header

werkzeug.parse_options_header(value, multiple=False)[source]

Parse a Content-Type like header into a tuple with the content type and the options:

>>> parse_options_header('text/html; charset=utf8')
('text/html', {'charset': 'utf8'})

This should not be used to parse Cache-Control like headers that use a slightly different format. For these headers use the parse_dict_header() function.

New in version 0.5.

Parameters:
  • value – the header to parse.
  • multiple – Whether try to parse and return multiple MIME types
Returns:

(mimetype, options) or (mimetype, options, mimetype, options, …) if multiple=True