Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé
Classe « Response »

Méthode flask.wrappers.Response.set_cookie

Signature de la méthode set_cookie

def set_cookie(self, key: 'str', value: 'str' = '', max_age: 'timedelta | int | None' = None, expires: 'str | datetime | int | float | None' = None, path: 'str | None' = '/', domain: 'str | None' = None, secure: 'bool' = False, httponly: 'bool' = False, samesite: 'str | None' = None, partitioned: 'bool' = False) -> 'None' 

Description

help(Response.set_cookie)

Sets a cookie.

A warning is raised if the size of the cookie header exceeds
:attr:`max_cookie_size`, but the header will still be set.

:param key: the key (name) of the cookie to be set.
:param value: the value of the cookie.
:param max_age: should be a number of seconds, or `None` (default) if
                the cookie should last only as long as the client's
                browser session.
:param expires: should be a `datetime` object or UNIX timestamp.
:param path: limits the cookie to a given path, per default it will
             span the whole domain.
:param domain: if you want to set a cross-domain cookie.  For example,
               ``domain="example.com"`` will set a cookie that is
               readable by the domain ``www.example.com``,
               ``foo.example.com`` etc.  Otherwise, a cookie will only
               be readable by the domain that set it.
:param secure: If ``True``, the cookie will only be available
    via HTTPS.
:param httponly: Disallow JavaScript access to the cookie.
:param samesite: Limit the scope of the cookie to only be
    attached to requests that are "same-site".
:param partitioned: If ``True``, the cookie will be partitioned.

.. versionchanged:: 3.1
    The ``partitioned`` parameter was added.


Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé