Navigation

The http.cookies module defines classes for abstracting the concept of
cookies, an HTTP state management mechanism. It supports both simple string-only
cookies, and provides an abstraction for having any serializable data-type as
cookie value.

The module formerly strictly applied the parsing rules described in the
RFC 2109 and RFC 2068 specifications. It has since been discovered that
MSIE 3.0x doesn’t follow the character rules outlined in those specs and also
many current day browsers and servers have relaxed parsing rules when comes to
Cookie handling. As a result, the parsing rules used are a bit less strict.

This class is a dictionary-like object whose keys are strings and whose values
are Morsel instances. Note that upon setting a key to a value, the
value is first converted to a Morsel containing the key and the value.

Return a string representation suitable to be sent as HTTP headers. attrs and
header are sent to each Morsel‘s output() method. sep is used
to join the headers together, and is by default the combination '\r\n'
(CRLF).

Return a string representation of the Morsel, suitable to be sent as an HTTP
header. By default, all the attributes are included, unless attrs is given, in
which case it should be a list of attributes to use. header is by default
"Set-Cookie:".