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é
Classe « Response »

Méthode flask.Response.force_type

Signature de la méthode force_type

def force_type(response: 'Response', environ: 'WSGIEnvironment | None' = None) -> 'Response' 

Description

help(Response.force_type)

Enforce that the WSGI response is a response object of the current
type.  Werkzeug will use the :class:`Response` internally in many
situations like the exceptions.  If you call :meth:`get_response` on an
exception you will get back a regular :class:`Response` object, even
if you are using a custom subclass.

This method can enforce a given response type, and it will also
convert arbitrary WSGI callables into response objects if an environ
is provided::

    # convert a Werkzeug response object into an instance of the
    # MyResponseClass subclass.
    response = MyResponseClass.force_type(response)

    # convert any WSGI application into a response object
    response = MyResponseClass.force_type(response, environ)

This is especially useful if you want to post-process responses in
the main dispatcher and use functionality provided by your subclass.

Keep in mind that this will modify response objects in place if
possible!

:param response: a response object or wsgi application.
:param environ: a WSGI environment object.
:return: a response object.


Vous êtes un professionnel et vous avez besoin d'une formation ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé