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 ? Machine Learning
avec Scikit-Learn
Voir le programme détaillé
Module « flask.testing »

Classe « Client »

Informations générales

Héritage

builtins.object
    Client

Définition

class Client(builtins.object):

help(Client)

Simulate sending requests to a WSGI application without running a WSGI or HTTP
server.

:param application: The WSGI application to make requests to.
:param response_wrapper: A :class:`.Response` class to wrap response data with.
    Defaults to :class:`.TestResponse`. If it's not a subclass of ``TestResponse``,
    one will be created.
:param use_cookies: Persist cookies from ``Set-Cookie`` response headers to the
    ``Cookie`` header in subsequent requests. Domain and path matching is supported,
    but other cookie parameters are ignored.
:param allow_subdomain_redirects: Allow requests to follow redirects to subdomains.
    Enable this if the application handles subdomains and redirects between them.

.. versionchanged:: 2.3
    Simplify cookie implementation, support domain and path matching.

.. versionchanged:: 2.1
    All data is available as properties on the returned response object. The
    response cannot be returned as a tuple.

.. versionchanged:: 2.0
    ``response_wrapper`` is always a subclass of :class:``TestResponse``.

.. versionchanged:: 0.5
    Added the ``use_cookies`` parameter.

Constructeur(s)

Signature du constructeur Description
__init__(self, application: 'WSGIApplication', response_wrapper: 'type[Response] | None' = None, use_cookies: 'bool' = True, allow_subdomain_redirects: 'bool' = False) -> 'None'

Liste des opérateurs

Opérateurs hérités de la classe object

__eq__, __ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__repr__(self) -> 'str'
delete(self, *args: 't.Any', **kw: 't.Any') -> 'TestResponse' Call :meth:`open` with ``method`` set to ``DELETE``. [extrait de delete.__doc__]
delete_cookie(self, key: 'str', *, domain: 'str' = 'localhost', path: 'str' = '/') -> 'None' Delete a cookie if it exists. Cookies are uniquely identified by [extrait de delete_cookie.__doc__]
get(self, *args: 't.Any', **kw: 't.Any') -> 'TestResponse' Call :meth:`open` with ``method`` set to ``GET``. [extrait de get.__doc__]
get_cookie(self, key: 'str', domain: 'str' = 'localhost', path: 'str' = '/') -> 'Cookie | None' Return a :class:`.Cookie` if it exists. Cookies are uniquely identified by [extrait de get_cookie.__doc__]
head(self, *args: 't.Any', **kw: 't.Any') -> 'TestResponse' Call :meth:`open` with ``method`` set to ``HEAD``. [extrait de head.__doc__]
open(self, *args: 't.Any', buffered: 'bool' = False, follow_redirects: 'bool' = False, **kwargs: 't.Any') -> 'TestResponse' Generate an environ dict from the given arguments, make a [extrait de open.__doc__]
options(self, *args: 't.Any', **kw: 't.Any') -> 'TestResponse' Call :meth:`open` with ``method`` set to ``OPTIONS``. [extrait de options.__doc__]
patch(self, *args: 't.Any', **kw: 't.Any') -> 'TestResponse' Call :meth:`open` with ``method`` set to ``PATCH``. [extrait de patch.__doc__]
post(self, *args: 't.Any', **kw: 't.Any') -> 'TestResponse' Call :meth:`open` with ``method`` set to ``POST``. [extrait de post.__doc__]
put(self, *args: 't.Any', **kw: 't.Any') -> 'TestResponse' Call :meth:`open` with ``method`` set to ``PUT``. [extrait de put.__doc__]
resolve_redirect(self, response: 'TestResponse', buffered: 'bool' = False) -> 'TestResponse' Perform a new request to the location given by the redirect [extrait de resolve_redirect.__doc__]
run_wsgi_app(self, environ: 'WSGIEnvironment', buffered: 'bool' = False) -> 'tuple[t.Iterable[bytes], str, Headers]' Runs the wrapped WSGI app with the given environment. [extrait de run_wsgi_app.__doc__]
set_cookie(self, key: 'str', value: 'str' = '', *, domain: 'str' = 'localhost', origin_only: 'bool' = True, path: 'str' = '/', **kwargs: 't.Any') -> 'None' Set a cookie to be sent in subsequent requests. [extrait de set_cookie.__doc__]
trace(self, *args: 't.Any', **kw: 't.Any') -> 'TestResponse' Call :meth:`open` with ``method`` set to ``TRACE``. [extrait de trace.__doc__]

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __getstate__, __hash__, __init_subclass__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

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