werkzeug.parse_cookie¶
Parse a cookie. Either from a string or WSGI environ.
Per default encoding errors are ignored. If you want a different behavior you can set errors to
'replace'
or'strict'
. In strict mode aHTTPUnicodeError
is raised.Changed in version 0.5: This function now returns a
TypeConversionDict
instead of a regular dict. The cls parameter was added.Parameters: - header – the header to be used to parse the cookie. Alternatively this can be a WSGI environment.
- charset – the charset for the cookie values.
- errors – the error behavior for the charset decoding.
- cls – an optional dict class to use. If this is not specified
or None the default
TypeConversionDict
is used.