Set an outgoing HTTP cookie.

In general, you should consider using sessions instead of cookies, see twisted.web.server.Request.getSession and the twisted.web.server.Session class for details.

Parameterskcookie name (type: bytes or unicode)
vcookie value (type: bytes or unicode)
expirescookie expire attribute value in "Wdy, DD Mon YYYY HH:MM:SS GMT" format (type: bytes or unicode)
domaincookie domain (type: bytes or unicode)
pathcookie path (type: bytes or unicode)
max_agecookie expiration in seconds from reception (type: bytes or unicode)
commentcookie comment (type: bytes or unicode)
securedirect browser to send the cookie on encrypted connections only (type: bool)
httpOnlydirect browser not to expose cookies through channels other than HTTP (and HTTPS) requests (type: bool)
sameSiteOne of None (default), 'lax' or 'strict'. Direct browsers not to send this cookie on cross-origin requests. Please see: https://tools.ietf.org/html/draft-west-first-party-cookies-07 (type: None, bytes or unicode)
RaisesDeprecationWarning if an argument is not bytes or unicode. ValueError if the value for sameSite is not supported.
Function _ensureBytes Ensure that val is bytes, encoding using UTF-8 if needed.
Function _sanitize No summary
def _ensureBytes(val): (source)

Ensure that val is bytes, encoding using UTF-8 if needed.

Parametersvalbytes or unicode
Returnsbytes
def _sanitize(val): (source)
API Documentation for Twisted, generated by pydoctor at 2020-03-20 23:54:06.