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 ? Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé
Classe « Client »

Méthode flask.testing.Client.set_cookie

Signature de la méthode set_cookie

def set_cookie(self, key: 'str', value: 'str' = '', *, domain: 'str' = 'localhost', origin_only: 'bool' = True, path: 'str' = '/', **kwargs: 't.Any') -> 'None' 

Description

help(Client.set_cookie)

Set a cookie to be sent in subsequent requests.

This is a convenience to skip making a test request to a route that would set
the cookie. To test the cookie, make a test request to a route that uses the
cookie value.

The client uses ``domain``, ``origin_only``, and ``path`` to determine which
cookies to send with a request. It does not use other cookie parameters that
browsers use, since they're not applicable in tests.

:param key: The key part of the cookie.
:param value: The value part of the cookie.
:param domain: Send this cookie with requests that match this domain. If
    ``origin_only`` is true, it must be an exact match, otherwise it may be a
    suffix match.
:param origin_only: Whether the domain must be an exact match to the request.
:param path: Send this cookie with requests that match this path either exactly
    or as a prefix.
:param kwargs: Passed to :func:`.dump_cookie`.

.. versionchanged:: 3.0
    The parameter ``server_name`` is removed. The first parameter is
    ``key``. Use the ``domain`` and ``origin_only`` parameters instead.

.. versionchanged:: 2.3
    The ``origin_only`` parameter was added.

.. versionchanged:: 2.3
    The ``domain`` parameter defaults to ``localhost``.


Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les fondamentaux
Voir le programme détaillé